Minecraft 1.14/1.15 modding with Forge – 1 – Setting up a dev environment

Hello everyone,

This tutorial will work for FG3, which is used by forge from 1.13.

Before I get started:
You should have an IDE installed. I will be using IntelliJ IDEA, but it is also possible to use Eclipse. I will not be teaching Java so you should do a Java tutorial first if you don’t have any experience. Most steps are the same on different operating systems, but some steps may differ. Make sure you have jdk 8 64 bit installed. I’d recommend getting openjdk.

Well, let’s get started!

  1. First, you should download the latest version of Forge (This tutorial will be for Minecraft 1.14).
    Go to the Forge download site and download the MDK (Mod Development Kit).
  2.  Extract the downloaded file to an empty folder. You should see a lot of files, but you don’t need all of these files to get started.
    You only need:

    • the gradle folder
    • The .gitignore file
    • build.gradle
    • gradle.properties
    • gradlew
    • gradlew.bat
  3. Copy these files in a new folder. I will be referring to this folder as the root folder.
  4. Open the build.gradle with a text editor and replace the group and archiveBaseName variables with your name and modid, following the format specified.
  5. Now import the project in your IDE of choice, I’ll be using (and explaining it for) IntelliJ IDEA.
    1. Click on Import Project, or File –> new –> project from existing sources
    2. Browse to your root folder and select the build.gradle
    3. Make sure you have “Create directories for empty content roots automatically” are checked (This option was removed in future IntelliJ versions. You now have to create the src/main/java and src/main/resources folder yourself!). You can also check “Use auto-import” if you want to.
    4. IntelliJ and gradle should initialize everything needed. (This may take a couple of minutes, for me it took about 5 minutes)
  6. In IntelliJ you need to run genIntellijRuns, you can do this by either running the command (there is also genEclipseRuns, and genVSCodeRuns):
    ./gradlew genIntellijRuns

    or by opening the gradle menu and under “Tasks/fg_runs” double clicking genIntellijRuns. After running this you’ll get a client and server run task, the first time you run it’ll ask you to fix an error, you fix this by selecting the main module in the “Use classpath of module:” selection list. (Image is from 1.13.2, the configuration is now called runClient and runServer by default)

    1. If you are using IntelliJ you need to go into the gradle settings by opening the gradle tab on the right and clicking the wrench icon.
      Then make sure Build and Run is set to IntelliJ.
  7. Now you are ready to start modding!

You probably also want to set up 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:

  1. Create an account at github.com
  2. Create a repository by clicking the plus button at the top right.
  3. Copy the URL it gives you, the URL should be in the following format: https://github.com/USERNAME/REPONAME.git
  4. Download git and install it
  5. Open a PowerShell/command prompt/terminal. If you are on Windows you can hold shift and right click in the root folder.
  6. run:
    1. git init      This will initialize the git repository
    2. git remote add origin URL FROM STEP 3       This will tell git where to upload the code
    3. git add .     This will add all of the files in the current repository to your git repo. Make sure you add the “.”!
    4. git commit -m “My first commit!”    This will tell git to remember the state of all your files at this point in time
    5. git push origin master     This will upload your code to the repository you made earlier!
  7. Now when you made changes you only need to run:
    1. git add .
    2. git commit -m “Message explaining changes”
    3. 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!

~suppergerrie2

Posted in Forge tutorial, Forge Tutorial 1.14, Forge Tutorial 1.15.

14 Comments

  1. A note: The latest version of IntelliJ IDEA works a bit differently.
    There is no “Import Project”, instead use “File->New->Project from existing source” and navigate to the root folder and press OK. You don’t need to do much more than wait after that, while the build step is handled for you (the one that took SG about 5 minutes).

    After that, the Task menu is also gone. You can’t just run GradleW from the terminal either.
    Instead, go to “View->Tool Windows->Gradle” and a new docked window should appear. In this, you’ll see the root folder, but opening it shows all your Gradle tasks. Navigate to “Task->fg_runs” and right-click the genIntellijRuns task, then click on Run.

    You may now close the Gradle window, we are done with the basic setup.

    • Import project only appears on the main menu of intellij I think. You should be able to run gradlew from the terminal tho.

      Another thing you may need to do is go into the gradle menu -> gradle settings -> and set build and run to intellij.

    • It’s the unique id of your mod. It should be changed to something recognizable but unique for your mod.

  2. Hi! Great tutorial but I get this error after executing the “git push origin master” command :

    To https://github.com/myusername/myreponame.git
    ! [rejected] master -> master (non-fast-forward)
    error: failed to push some refs to ‘https://github.com/Hunam6/TechAssembly.git’
    hint: Updates were rejected because the tip of your current branch is behind
    hint: its remote counterpart. Integrate the remote changes (e.g.
    hint: ‘git pull …’) before pushing again.
    hint: See the ‘Note about fast-forwards’ in ‘git push –help’ for details.

    Please help me 🙂

  3. Ive got JDK 8 installed and HOME path setup. But, intelliJ is showing i am using java 11.

    Build file ‘C:\Users\lostk\Desktop\Minecraft Forge\root\build.gradle’ line: 11

    * What went wrong:
    A problem occurred evaluating root project ‘root’.
    > Failed to apply plugin [id ‘net.minecraftforge.gradle’]
    > Found java version 11.0.4. Minimum required is 1.8.0_101. Versions 11.0.0 and newer are not supported yet.

    Any help would be appreciated.

  4. You forgot to speak about java JDK installation, path variable or JAVA_HOME setup and error with gradle if you try to use the latest Java JDK version wich is 12

    • Yeah you need java 8. JDK installation is out of scope for the tutorial. This is not a java tutorial but a forge tutorial.

      • True, but others may trip over this too, for any that do, you can set the java path in your gradle.properties file to something like this:

        org.gradle.java.home=C:/Program Files/Java/jdk1.8.0_121

        or whatever your java path is. do take note that those are back slashes, not normal windows slashes you’d see in the terminal. IDEA will highlight the wrong ones as escape characters, so you’ll know you need to change them.

Comments are closed.