Modding Minecraft with Forge

Lesson 1 of 6

Setting Up a Forge Mod Development Environment

Minecraft mods written in Java are built against Forge, a modding API and loader that hooks into the base game. Forge ships a Mod Development Kit (MDK), a ready-to-go Gradle project you build your mod on top of instead of starting from nothing.

What you'll need

  • A Java Development Kit matching your target Minecraft version (JDK 17 for modern 1.20.x Forge).
  • The Forge MDK for the Minecraft version you're targeting, downloaded from Forge's files page and unzipped into your project folder.
  • An IDE with Gradle support, IntelliJ IDEA or Eclipse both work well.

Getting the MDK running

From inside the unzipped MDK folder:

./gradlew genIntellijRuns

(genEclipseRuns for Eclipse instead), this generates run configurations for launching Minecraft with your mod loaded. Then launch the game itself:

./gradlew runClient

The first run downloads a full Minecraft client and Forge's patched sources, expect it to take a while. If it succeeds, you'll see the normal Minecraft title screen with your (currently empty) mod already loaded.

mods.toml

Every Forge mod describes itself in src/main/resources/META-INF/mods.toml:

modLoader="javafml"
loaderVersion="[47,)"

[[mods]]
modId="examplemod"
version="1.0.0"
displayName="Example Mod"

modId is the mod's unique internal identifier, lowercase, no spaces, you'll reference it constantly in code and in every resource file path.

📝 Forge Setup Quiz

Passing score: 70%
  1. 1.What does Forge's MDK provide?

  2. 2.A mod's unique internal identifier, declared in mods.toml, is called its ____.

  3. 3.The Gradle task runClient launches Minecraft with your mod already loaded.