I have been messing around with modding minecraft for the last few days and noticed the lack of tutorials for 1.12. So I thought why not write a tutorial myself. Warning: the way I structured my code and the way I wrote the code may not be the ideal way!
Before I get started:
You should have an IDE installed. I will be using eclipse, but it is also possible to use IntelliJ. I will not be teaching java so you should do a java tutorial first if you don’t have any experience. Also I am using windows 10 and I have no idea how to do it on an other OS. Sorry D: (But it shouldn’t be so different I think). I am planning on releasing a part of this tutorial every friday 18:00 pm GMT+2.
Well lets get started!
- First you should download the latest version of forge (This tutorial will be for minecraft 1.12), I will be using forge-1.12-22.214.171.1247.
Go to the forge download site and download the mdk (Mod Development Kit).
- Extract the downloaded file to an empty folder. You should see a lot of files:
You don’t need all of these files to get started.
You only need:
- the gradle folder
- The gradlew file (Not showed in picture because I forgot to add this when first making the tutorial)
- The .gitignore file (Will be helpful in the future, this is not showed in the picture because I forgot this when making the tutorial. Sorry!)
- Copy these files in a new folder. I called my folder: “ForgeTutorial”. I will be referring to this folder as the root folder.
- While in the root folder make sure you have no files selected and while holding the shift button right click in the folder. A menu should come up and there should be an option “open command window here” or “open powershell window here”. Click on it and a command window or powershell window. Type: “.\gradlew setupDecompWorkspace” without the quotes and press enter. It will probably not skip as much as in the image but you should get “BUILD SUCCESSFUL”.
- If you are not using eclipse this step will be different for you, but if you are using eclipse follow this step. You have to execute one more command, type “.\gradlew eclipse” and press enter. Again it will probably skip less for you but you should get “BUILD SUCCESSFUL”.
- Now open eclipse and select a folder you want your workspace to be in. Press File→Import . This will open a prompt select General→Existing Projects into Workspace and click next. Make sure you have “select root directory” selected and click browse. Browse to your root folder and select it. Eclipse will see it as an project and not give any errors. Now click Finish.
- Now you are ready to start modding!
You probably also want to setup a git repository so you can share your code and people can help you. If you know how to do this you can just skip to the next part.
I’ll explain how to put the repository on github, there are other websites where you can put it but I am familiar with github.
To create a repository and upload your code follow the following steps:
- Create an account at github.com
- Create a repositry by clicking the plus button at the top right.
- Copy the url it gives you, the url should be in the following format: https://github.com/USERNAME/REPONAME.git
- Download git and install it
- Open a powershell/command prompt/terminal. If you are on windows you can hold shift and right click in the root folder. On other operating systems you may need to use the “cd” command to change your directory to the root folder
- git init This will initialize the git repository
- git remote add origin URL FROM STEP 3 This will tell git where to upload the code
- git add . This will add all of the files in the current repository to your git repo. Make sure you add the “.” !
- git commit -m “My first commit!” This will tell git to remember the state of all your files at this point in time
- git push origin master This will upload your code to the repository you made earlier!
- Now when you made changes you only need to run:
- git add .
- git commit -m “Message explaining changes”
- git push origin master
I hope that was easy to follow! If you have any question don’t hesitate to ask in the comments! Also if you saw any errors in the tutorial please let me know so I can fix it!
Next time we will start setting up the MainMod file.
Till next time!