Setting up a Development Environment for Forge Modding

Note: Since I have a Windows machine this tutorial will focus on that platform.

Java Development Kit

You will need the JDK to develop in Java. You can get the latest JDK at the Oracle website. Make sure you download the Java SE 8u201 / Java SE 8u202 and make sure you download the JDK (not the JRE).

IDE – Eclipse

The IDE (Integrated Development Environment) is where you will write all your code. You will need an IDE for Java development. You can use any IDE you like, but most tutorials use Eclipse, and since I like Eclipse I will follow suit.

If you download the Eclipse Installer and run it you will be given an option on which IDE to install.

We need to choose Eclipse IDE for Java Developers. You can then select a directory to use as your first workspace. If you have many hard drives you should choose the one that has the most free space.

Set Up Forge

You will need to download the Forge MDK to develop Forge Mods. Make sure to download the correct version you wish to develop mods for. Select the MDK on the right for downloading and NOT the Windows Installer:

At the time of writing 1.12.2 was the latest stable version that Forge supports. The following tutorials will focus on that version for modding Minecraft.

After downloading Forge, you can extract it to the folder where you created the workspace :

Open Eclipse and select File -> Open Projects from File System… and select Forge project folder:

Now we need to decompile Minecraft. Navigate to the Forge folder in Explorer. Hold shift + right-click and select Open PowerShell window here. You should now see the following:

From here we need to run three commands. Some of these commands will take a while to run so be patient.

.\gradlew tasks

This will setup the project and give you a list of tasks you can run.

 .\gradlew setupDecompWorkspace 

This will decompile MineCraft and set up the project ready for modding. This command will take a while, especially if you have a slow internet connection.

 .\gradlew eclipse

This will set up the Eclipse project.

And that’s it – we can now start modding Minecraft! But first we should think about Source Control.

Source Control: Github

Source control helps you track changes to projects over time. It can help you back up and revert changes that may have messed up your code. It’s vital for any development project, even if you work alone.

In my professional life I prefer Perforce, but Github is great for open source and solo projects.

You can create a github account at their website. Once you have done so, click the + in the top right to create a new repository.

Give the project any name you like then note the URL of the project.

Next we need to download and install git. Once we have done so we can open up our PowerShell window on the Forge directory again:

You can then run the following commands to create a git repository:

git init

This will initialise a git repository.

 git remote add origin <URL_TO_YOUR_REPO> 

This will tell git which repository to upload your code. Replace <URL_TO_YOUR_REPO> with the repo you created in git. For example, is my repo.

git add .

This will add all files in the folder to the local repo. Don’t forget the dot at the end of this command.

git commit -m "My First Commit!" 

This will commit the files to the local repo, saving their current state.

git push origin master

Finally this will upload your changes to the remote repo on github.

After this you can continue to use the command line to commit new changes. To do this you can use the last three commands in PowerShell:

git add .
git commit -m "<MY_CHANGE_DESCRIPTION>"
git push origin master

You could also download Git for Windows and use that instead.


Here are all the resources listed in this article:

Here are a couple of tutorials I found useful for this. The Medium article sends you to an old version of Forge but it still contains useful information. Supergerrie2’s site contains many other tutorials for 1.12 modding that I’ve found useful so far.

How to Learn Minecraft Modding

Learning for the sake of learning is an exercise in futility. You will often end up losing focus and will never have achieved anything. You need to set a clear goal, and then figure out how to meet that goal.

What this means for Minecraft modding is that you shouldn’t set out to learn how to mod. You will learn how to add an item, a new material, a block, and a lot of basic things. But it will be a long time before you take the leap and create an actual mod.

Rather, you should figure out what you want to *create* first. Then figure out how to create that thing. It doesn’t hurt to keep your goals simple at first.

So that’s what this post is about. What do I want to create first?

Doc’s Dagger Mod

The design I’ve come up with is by no means original, but it should help me create something solid while I learn how to mod. I want to create an alternative weapon: a dagger.

The dagger will have 5 subtypes like any other tool: wooden, stone, iron, gold and diamond. Other mods could then extend this if they wanted to.

The dagger will do less damage than a sword but will attack faster. It will also have half the durability of a sword of the same type. It will not have a sweep attack – it will attack only one enemy at a time.

Players should be able to throw daggers. Doing so will cause the same damage as a melee attack. This will cost 1 durability if they hit a creature, or 2 durability if they hit a block. Thrown daggers will be recoverable provided they don’t break.

Until Next Time

So that’s the basic mod I’ve designed. By no means original, but it’s a simple goal that will leave me with a complete mod at the end. I’m confident I can learn how to do all/most of this. It won’t teach me *everything* there is to learn about Minecraft modding, but it will give me a start. And if I enjoy it, I can always design another mod after this one.