The first thing you’ll need to get started is the latest JDK 8. Download it from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html.
Follow the instructions in the installer.
After the JDK finishes installing, you’ll need to set the Path and JAVA_HOME environment variables. This tells Forge where you’ve installed Java. To do this (in Windows 10), right-click the start menu and go to System. Then, scroll down until you see System Info.
Click that, and in the window that pops up, click on advanced system settings.
Click the Environment Variables… button. In system variables, edit the Path variable or create it if you don’t have it. Add the path to the bin folder of the jdk you just installed. This should look something like this: C:\Program Files\Java\jdk1.8.0_172\bin. DO NOT DELETE ANY OTHER VALUES IN THIS VARIABLE. Doing so could mess up your computer! Next, click OK. Now, create the JAVA_HOME system variable. The path that goes into this one should be exactly the same as the last one, except for the lack of \bin. It should look something like this: C:\Program Files\Java\jdk1.8.0_172. After you create it, click OK in all the boxes. Congrats! Java is completely set up!
The next step is to download Eclipse. Eclipse is the IDE we will be using for these tutorials. You can also use IntelliJ IDEA, but we will only be covering Eclipse. Go to http://www.eclipse.org/ to download Eclipse. You can use their installer, or you can download a package (my preferred method). Whichever one you choose, make sure to get the Eclipse IDE for Java EE Developers.
To install a package, simply download the zip from http://www.eclipse.org/downloads/eclipse-packages/ and extract it to a folder of your choosing. Now that Eclipse is installed, let’s install Forge!
First, you’ll need to go to http://files.minecraftforge.net/. Download the latest MDK (NOT the installer!). Extract the zip to any directory. Open a command prompt in that directory and enter this command: “gradlew setupDecompWorkspace eclipse” (without the quotes). This sets up the Minecraft development environment for Eclipse, and it may take a while, so be patient!
Almost there! To finish setting up, we need to open up Eclipse. Create a new workspace wherever you want, and when the welcome screen shows up, go to the workbench. In this tutorial, we will be using a multi-project setup. This won’t be too useful now, but when you start making your own mods, it will be great, because you won’t have to re-install the MDK every time you want to make a new mod.
To do this, you first have to create a new project in Eclipse by right-clicking in the Project Explorer and clicking New > Project… > Java Project. This will be where all the code for your mod resides.
Create two new source folders by right-clicking the project and going to New > Source Folder. Name them src/main/java and src/main/resources. Make sure to check “Update exclusion filters in other source folders to solve nesting”, or Eclipse will not let you create the folders. When this is done, you can delete the default src folder.
Now, go to File > Import… > General > Existing Projects into Workspace. Browse to where you extracted your MDK. A project should appear. Click Finish to import Forge into the workspace. You should rename this project to something nice, like Forge 1.12.2.
In order for our project to use Forge, we have to add it to the build path. Right-click the TutorialMod package and go to Build Path > Configure Build Path. Go to the projects tab and click Add, then select the Forge 1.12.2 project. Click OK, then Apply and Close. Then go to the build path properties of the Forge 1.12.2 project. In the Order and Export tab, select all and apply and close.
Finally, we need to set up launch configurations. To do this, select the TutorialMod project and go to Run > Run Configurations. Under Java Application, create two new run configurations. Name them something like TutorialClient and TutorialServer. In TutorialClient, set the main class as GradleStart, and in TutorialServer, set it as GradleStartServer. In the Arguments tab of TutorialClient, under program arguments, you can specify a user with the flags –username=<your e-mail address> –password=<your password>.
Once both configurations are finished, you can now run Minecraft from Eclipse! Make sure to edit the eula.txt file to say true if you want to run a server.
Congratulations! You’ve set up everything you need to start developing Minecraft Forge mods!