- Obtain a source distribution from forge’s files site. (Look for the Mdk file type, or Src in older 1.8/1.7 versions).
- Extract the downloaded source distribution to an empty directory. You should see a bunch of files, and an example mod is placed in
src/main/javafor you to look at. Only a few of these files are strictly necessary for mod development, and you may reuse these files for all your projects These files are:
- Move the files listed above to a new folder, this will be your mod project folder.
- Open up a command prompt in the folder you created in step (3), then run
gradlew setupDecompWorkspace. This will download a bunch of artifacts from the internet needed to decompile and build Minecraft and forge. This might take some time, as it will download stuff and then decompile Minecraft. Note that, in general, these things will only need to be downloaded and decompiled once, unless you delete the gradle artifact cache.
- Choose your IDE: Forge explicitly supports developing with Eclipse or IntelliJ environments, but any environment, from Netbeans to vi/emacs, can be made to work.
- For Eclipse, you should run
gradlew eclipse– this will download some more artifacts for building eclipse projects and then place the eclipse project artifacts in your current directory.
- For IntelliJ, simply import the build.gradle file.
- Load your project into your IDE.
- For Eclipse, create a workspace anywhere (though the easiest location is one level above your project folder). Then simply import your project folder as a project, everything will be done automatically.
- For IntelliJ, you only need to create run configs. You can run
gradlew genIntellijRunsto do this.
- Launch IDEA and choose to open/import the
build.gradlefile, using the default gradle wrapper choice. While you wait for this process to finish, you can open the gradle panel, which will get filled with the gradle tasks once importing is completed.
- Run the
setupDecompWorkspacetask (inside the
forgegradletask group). It will take a few minutes, and use quite a bit of RAM. If it fails, you can add
Gradle VM optionsin IDEA’s gradle settings window, or edit your global gradle properties.
- Once the setup task is done, you will want to run the
genIntellijRunstask, which will configure the project’s run/debug targets.
- After it’s done, you should click the blue refresh icon on the gradle panel (there’s another refresh icon on the main toolbar, but that’s not it). This will re-synchronize the IDEA project with the Gradle data, making sure that all the dependencies and settings are up to date.