From Minecraft Forge
Jump to: navigation, search

How-To Icon.png

This is a How-To guide or Tutorial detailing a practice or process for Minecraft Forge or related software.

Installing Minecraft Forge is a simple process. Follow these steps exactly, and you should be fine. You should also read all of the instructions before beginning, including the common errors and warnings.


Installation Process

You MUST have the JDK installed

If you do not, install Java SDK Standard Edition (short JDK). Then, add the paths to your JDK and JRE bin folders to the Environment Variable PATH.

Example for Windows users of what you have to add to the variable (entries are seperated by ";" ):

C:\Program Files\Java\jdk1.6.0_24\bin;C:\Program Files\Java\jre6\bin

You should also be able to use Java 7 (JDK 1.7), but doing so means that all users of your mod must also be using Java 7. (If using Eclipse, you can still use Java 7 and compile for Java 6. To do this, choose the Compiler compliance level to 1.6 by going to Window->Preferences->Java->Compiler. If you only want to do this for your Minecraft project, make sure you select Configure Project Specific Settings... and only change the settings there.)


Step 1

Download a fresh copy of the Forge source by selecting the latest 'Source' build (called 'MDK', Minecraft Development Kit, for Minecraft 1.8 and above). You can also try the latest build, but it may be buggy.

After that has downloaded it, extract it to a folder wherever you wish.

It should unpack, and you should see these files, or their future counterparts.


Step 2
  • For Windows
Hold down shift, and right click, then select "Open command window here".
  • For Linux/Mac OS:
Start your terminal (found in utilities), then navigate your way to your Forge directory with "cd".

Step 3

Once you have a command window up in the folder that the downloaded material was placed, type

  • For Windows:
gradlew setupDecompWorkspace --refresh-dependencies
  • For Linux/Mac OS:
./gradlew setupDecompWorkspace --refresh-dependencies
If this doesn't work, type chmod +x gradlew and then retry the above command.

It takes a varying amount of time, less than ten minutes is average. Why not get something to eat while this happens?

This will do quite a lot of tasks:

  • Download most requirements (Minecraft, MCP(Mod Coder Pack), Java Libraries, Gradle, Forge, and FML)
  • Set up Forge, with MCP and Gradle.

Step 4

After all that finished, you're left with a choice.

What IDE(Integrated Development Environment) do you use?

Eclipse or Intellij IDEA?

If you run eclipse, all you have to do now is run

  • For Windows
gradlew eclipse
  • For Linux/Mac OS
./gradlew eclipse

If you run IDEA, the steps are a little different. Open IDEA Select 'import project' Navigate to your workspace and click on the build.gradle

Once IDEA finishes importing the project, close IDEA. In your command window, run

  • For Windows

gradlew genIntellijRuns

  • For Linux/Mac OS

./gradlew genIntellijruns

Step 5

The final step is the easiest: open your IDE. In eclipse, point it at the eclipse folder in your workspace. In IDEA, the project should open automatically from when you opened it above. If it doesn't, direct it at your workspace folder (it should show up as a little Intellij IDEA icon to signify it is already a project).


Using an IDE

Forge Directory Structure

If it's not listed here, then you probably aren't going to need to care about the directory/file.

The root directory for dealing with builds.
Just the compiled version of your mod.
Arguably, one of the most important folders, this folder is where the builds are compiled, and reobfuscated, and zipped into a .jar.
The location your resources end up at while being compiled into the final build.
The pre-built workspace for Eclipse IDE users.
Just the gradle wrapper, the files that enable awesome build automation.
The folder that the source code will be located in when you set up eclipse, and push builds.
The location for your resources to be included in the build process

Other Useful Commands

gradlew build

This builds your mod and zips it into a .jar file you can distribute. Find the .jar file in build/libs.

gradlew runClient

This launches Minecraft with your mod installed.