Skip to main content
Version: FG5

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.

Prerequisites

  • An installation of the Java Development Kit (JDK)
Minecraft VersionsJava Development Kit Version
1.12 - 1.16JDK 8
1.17JDK 16
1.18 - 1.20.4JDK 17
1.20.5 - 1.21JDK 21
  • Familiarity with an Integrated Development Environment (IDE)
    • It is preferable to use one with some form of Gradle integration

Setting Up ForgeGradle

  1. First download a copy of the Modder Development Kit (MDK) from MinecraftForge and extract the zip to an empty directory.
  2. 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.
  3. Customize your Gradle buildscript for your mod:
    1. Set archivesBaseName to the desired mod id. Additionally, replace all occurrences of examplemod with the mod id as well.
    2. Change the group to your desired package name. Make sure to follow existing naming conventions.
    3. Change the version number to reflect the current version of your mod. It is highly recommended to use Forge's extension on semantic versioning.
caution

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 NeoForge docs for more information.

  1. 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
  1. If your IDE is either Eclipse, IntelliJ IDEA, or Visual Studio Code, you can generate run configurations using one of the following commands, respectively:

Eclipse

./gradlew genEclipseRuns

IntelliJ IDEA

./gradlew genIntellijRuns

Visual Studio Code

./gradlew genVSCodeRuns

You can the run the client, server, etc. using one of the generated run configurations.

tip

If your IDE is not listed, you can still run the configurations using ./gradlew run* (e.g., runClient, runServer, runData). You can use these commands with the supported IDEs as well.

Congratulations, now you have a development environment set up!