Minecraft 1.19.2 Forge模组开发 01.Idea开发环境配置

本文是Minecraft 1.19.2模组开发环境配置的教程。首先,从Forge官网或百度网盘下载MDK并解压,使用IntelliJ IDEA打开并配置SDK为Java 17。接着,修改build.gradle文件的group和archivesBaseName字段,然后重构项目主类并更新MOD_ID。最后,修改mods.toml中的modid,完成Gradle构建并运行客户端。
摘要由CSDN通过智能技术生成

我们本次来进行Minecraft 1.19.2 模组开发环境配置教程的介绍。

1.首先我们需要下载模组开发包:

1.19.2Forge MDK下载官网

找到Mdk的按钮点击并下载即可。

在这里插入图片描述

你也可以通过百度网盘下载该Mdk,下载链接附文末。

2.下载后解压该开发包,并用Idea打开:

cr.png

之后等待系统自动构建环境:

cr1.png

出现Build Successful则说明项目成功构建了。
打开文件 -> 项目结构 -> 修改SDK版本为Java17 -> 应用

cr2.png

打开文件 -> 设置 -> 构建,执行,部署 -> 修改Gradle JVM

cr3.png

3.打开build.gradle文件,修改group字段和archivesBaseName字段:

plugins {
    id 'eclipse'
    id 'maven-publish'
    id 'net.minecraftforge.gradle' version '5.1.+'
}

version = '1.0'
//修改为com.名称.你的模组名称
group = 'com.joy187.re8joymod' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
//修改为你的模组名称,只允许小写
archivesBaseName = 're8joymod'

// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
minecraft {
    // The mappings can be changed at any time and must be in the following format.
    // Channel:   Version:
    // official   MCVersion             Official field/method names from Mojang mapping files
    // parchment  YYYY.MM.DD-MCVersion  Open community-sourced parameter names and javadocs layered on top of official
    //
    // You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
    // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
    //
    // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
    // Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started
    //
    // Use non-default mappings at your own risk. They may not always work.
    // Simply re-run your setup task after changing the mappings to update your workspace.
    mappings channel: 'official', version: '1.19.2'

    // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default.

    // Default run configurations.
    // These can be tweaked, removed, or duplicated as needed.
    runs {
        client {
            workingDirectory project.file('run')

            // Recommended logging data for a userdev environment
            // The markers can be added/remove as needed separated by commas.
            // "SCAN": For mods scan.
            // "REGISTRIES": For firing of registry events.
            // "REGISTRYDUMP": For getting the contents of all registries.
            property 'forge.logging.markers', 'REGISTRIES'

            // Recommended logging level for the console
            // You can set various levels here.
            // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
            property 'forge.logging.console.level', 'debug'

            // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
            property 'forge.enabledGameTestNamespaces', 're8joymod'

            mods {
                re8joymod {
                    source sourceSets.main
                }
            }
        }

        server {
            workingDirectory project.file('run')

            property 'forge.logging.markers', 'REGISTRIES'

            property 'forge.logging.console.level', 'debug'

            property 'forge.enabledGameTestNamespaces', 're8joymod'

            mods {
                re8joymod {
                    source sourceSets.main
                }
            }
        }

        // This run config launches GameTestServer and runs all registered gametests, then exits.
        // By default, the server will crash when no gametests are provided.
        // The gametest system is also enabled by default for other run configs under the /test command.
        gameTestServer {
       
评论 17
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Jay_fearless

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值