Setting up the Development Environment

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.

setup0

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.

setup1

Click that, and in the window that pops up, click on advanced system settings.

setup2.PNG

 

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!

setup3

 

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.

setup4

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!

setup5

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!

setup6

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.

setup7

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.

setup8

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.

setup9

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>.

setup10

 

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.

setup11.PNG

Congratulations! You’ve set up everything you need to start developing Minecraft Forge mods!

18 thoughts on “Setting up the Development Environment

      1. Yep, that should work. Glad to hear you’re enjoying the tutorials! I’ll probably release a tutorial on the building process myself sometime soon here, as I’m sure that others will probably be wondering the same thing.

        Like

  1. I’m building gradle while it said build failed.
    my src is 1.7.10
    * What went wrong:
    Execution failed for task ‘:makeStart’.
    > Could not resolve all dependencies for configuration ‘:minecraftDeps’.
    > Could not resolve net.minecraft:launchwrapper:1.12.
    Required by:
    com.yourname.modid:1.7.10src:1.0
    > Could not GET ‘https://libraries.minecraft.net/net/minecraft/launchwrapper/1.12/launchwrapper-1.12.pom’.
    > peer not authenticated
    > Could not resolve lzma:lzma:0.0.1.
    Required by:
    com.yourname.modid:1.7.10src:1.0
    > Could not GET ‘https://libraries.minecraft.net/lzma/lzma/0.0.1/lzma-0.0.1.pom’.
    > peer not authenticated
    > Could not resolve com.paulscode:codecwav:20101023.
    Required by:
    com.yourname.modid:1.7.10src:1.0
    > Could not GET ‘https://libraries.minecraft.net/com/paulscode/codecwav/20101023/codecwav-20101023.pom’.
    > peer not authenticated
    > Could not resolve com.paulscode:libraryjavasound:20101123.
    Required by:
    com.yourname.modid:1.7.10src:1.0
    > Could not GET ‘https://libraries.minecraft.net/com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123.pom’.
    > peer not authenticated
    > Could not resolve com.paulscode:librarylwjglopenal:20100824.
    Required by:
    com.yourname.modid:1.7.10src:1.0
    > Could not GET ‘https://libraries.minecraft.net/com/paulscode/librarylwjglopenal/20100824/librarylwjglopenal-20100824.pom’.
    > peer not authenticated
    > Could not resolve com.paulscode:soundsystem:20120107.
    Required by:
    com.yourname.modid:1.7.10src:1.0
    > Could not GET ‘https://libraries.minecraft.net/com/paulscode/soundsystem/20120107/soundsystem-20120107.pom’.
    > peer not authenticated
    > Could not resolve com.mojang:authlib:1.5.16.
    Required by:
    com.yourname.modid:1.7.10src:1.0
    > Could not GET ‘https://libraries.minecraft.net/com/mojang/authlib/1.5.16/authlib-1.5.16.pom’.
    > peer not authenticated
    > Could not resolve tv.twitch:twitch:5.16.
    Required by:
    com.yourname.modid:1.7.10src:1.0
    > Could not GET ‘https://libraries.minecraft.net/tv/twitch/twitch/5.16/twitch-5.16.pom’.
    > peer not authenticated

    Like

    1. by the way, thanks to your tutorial, it’s very useful. but i think i got some problem that i don’t understand. I think some resources are lacked, but i don’t know what it is and how to fix it. I apologize for interrupting for such a easy problem, but I really can’t find another way.

      Like

      1. Sorry, but if you’re using 1.7.10, I simply can’t help you. This website is for 1.12 tutorials, and many things have changed in Forge since 1.7.10. If you really want to dev for 1.7.10, I would search for another tutorial.

        Like

  2. When I try to run the Tutorial Mod run configuration for the client I get the error: Error: Could not find or load main class GradelStart

    When I’m in the forge project, the Client run configuration starts minecraft fine. I’m guessing that some jar in the Forge project is not visible in some way in the Tutorial Project.

    I think your instructions need one more step some where?

    Like

      1. D’oh! Yes, you are correct, my poor spelling strikes again! It’s all working now.

        Thanks for the quick reply, and for the tutorial itself. This is the only one I found that covered a multi project format in eclipse. I hope I will write more than one mod so that should save time keeping them all straight and separate. Also thanks for including the pictures of the Eclipse GUI. That definitely helps.

        I plan to follow the rest of the tutorial over the rest of this week.

        I hope you put out a tutorial for how to migrate this project to Forge 1.13 when it comes out.

        Cheers.

        Like

  3. Hello me again. Well I had the set up working as far as starting mine craft with the version of forge I downloaded and it was displaying info for the Forge Example mod.

    However, now that I have created my TutorialMod Class I got an error about my mod not being compatible with the version of minecraft. I know how to fix this; I need to download a newer version of Forge that will work with 1.12.2 which is the version your tutorial assumes. I started with some other tutorials and that led me to start with Forge 1.12

    My actual questions are:

    1) For the future, when there are updates to Minecraft, and thus Forge, Do I have to go thru the whole process of downloading the new Forge MDK and run gradle, or is there a way to get gradle to the downloading for me by running another build command?

    2) Either way, can you update your tutorial with the answer/method? I’m sure others will want to know eventually.

    Thanks
    Michael

    Like

    1. 1) To update forge, just change the version listed in the build.gradle file to the latest version listed on files.minecraftforge.net. Then rerun the setup commands (gradlew setupDecompWorkspace eclipse).
      2) I’m actually moving (very slowly) through the process of moving my tutorials to GitHub Pages, as well as updating them a bit. I’ll try to remember to say something about updating Forge when I update.

      Like

  4. I’m trying to set up forge and it’s not working

    FAILURE: Build failed with an exception.

    * What went wrong:
    Could not determine java version from ‘11.0.2’.

    * Try:
    Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s