Setting up the Environment
Downloading your tools
To make a minecraft mod, you will need to download three things: a version of the java development kit (JDK), an IDE, and minecraft forge. We will go over these one at a time.
First, you will need to download and install jdk 8 from the Oracle website.
You now need to register an oracle account to access the downloads.
Moving on to next step, we will need to pick an IDE for writing code. I highly recommend IntelliJ IDEA, and it will be used for this tutorial. However, feel free to pick Eclipse or VSCode if you want.
Lastly, we will need to download the mdk archive for the forge version that we are targeting. In this tutorial, we will use forge 32.0.43 and develop for minecraft 1.16.1.
Make everything play nice together
You have to unzip the mdk file you just downloaded and move the files/folders listed below to a new location where you will develop your mod:
build.gradle gradle gradlew gradlew.bat
Now, you can open this newly created folder with all the files copied over in IntelliJ.
Build processes will kick in right after you open the folder in IntelliJ. Now would a good time to go make some coffee and come back later.
When the tasks finish, open the
Gradle tab on the right side and double click to run the
genIntellijRuns task. This is going to take some more time. Go make another cup of coffee I guess...
Test the water
Now, you should have everything ready to go. Let's have a quick test to verify that.
Go back to the unzip mdk archive from before, copy the
src folder, and replace the
src folder in our mod directory with it.
Then run the
runClient task in IntelliJ.
If everything is setup correctly, you will see minecraft pop up with your first mod loaded 🎉🎉🎉