Getting Started with ForgeGradle
If you have never used ForgeGradle before, here is the minimum amount of information needed to get a development environment setup.
- An installation of the Java Development Kit (JDK)
|Java Development Kit Version
|1.12 - 1.16
|1.18 - 1.19
- Familiarity with an Integrated Development Environment (IDE)
- It is preferable to use one with some form of Gradle integration
Setting Up ForgeGradle
- First download a copy of the Modder Development Kit (MDK) from MinecraftForge and extract the zip to an empty directory.
- Open the directory you extracted the MDK to within your IDE of choice. If your IDE integrates with Gradle, import it as a Gradle project.
- Customize your Gradle buildscript for your mod:
archivesBaseNameto the desired mod id. Additionally, replace all occurrences of
examplemodwith the mod id as well.
- Change the
groupto your desired package name. Make sure to follow existing naming conventions.
- Change the
versionnumber to reflect the current version of your mod. It is highly recommended to use Forge's extension on semantic versioning.
Make sure that any changes to the mod id are reflected in the mods.toml and main mod class. See Structuring Your Mod on the Forge docs for more information.
- Reload or refresh your Gradle project using your IDE. If your IDE does not have Gradle integration, run the following from a shell in your project's directory:
./gradlew build --refresh-dependencies
- If your IDE is either Eclipse, IntelliJ IDEA, or Visual Studio Code, you can generate run configurations using one of the following commands, respectively:
Visual Studio Code
You can the run the client, server, etc. using one of the generated run configurations.
If your IDE is not listed, you can still run the configurations using
./gradlew run* (e.g.,
runData). You can use these commands with the supported IDEs as well.
Congratulations, now you have a development environment set up!