Minecraft 1.13 modding with Forge – 1 – Setting up a dev environment

Hello everyone,

Forge for Minecraft 1.13 has been released, so here is the first part of the tutorial! 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 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 (like opening a command prompt).

Well, let’s get started!

  1. First, you should download the latest version of Forge (This tutorial will be for Minecraft 1.13). At the time of writing, this is version 25.0.10. 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:
    You don’t need all of these files to get started.
    You only need:

    • the gradle folder
    • The .gitignore file (Not technically needed but very useful!)
    • build.gradle
    • gradle.properties
    • gradlew
    • gradlew.bat
  3. Copy these files in a new folder. I called my folder: “ForgeTutorial”. I will be referring to this folder as the root folder.
  4. 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 “Use auto-import” and “Create directories for empty content roots automatically” are both checked.
    4. IntelliJ should automatically make gradle initialize everything needed. (This may take a couple of minutes, for me it took about 5 minutes)
  5. In IntelliJ you need to run genIntellijRuns, you can do this by either running the command:
    ./gradlew genIntellijRuns

    or by opening the gradle menu and under “Tasks/other” 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.

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

Also thanks to R3tromanCZ for checking this tutorial before release!

Till next time!

~suppergerrie2

Posted in Deprecated, Forge tutorial, Forge Tutorial 1.13.

14 Comments

  1. Cant get Intellij to be happy with this unforts

    Error:
    “The newly created daemon process has a different context than expected.
    It won’t be possible to reconnect to this daemon. Context mismatch:
    Java home is different.
    Wanted: DefaultDaemonContext[uid=null,javaHome=/Applications/IntelliJ IDEA.app/Contents/jdk/Contents/Home,daemonRegistryDir=/Users/USERNAME/.gradle/daemon,pid=20317,idleTimeout=null,daemonOpts=-Xmx3G,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
    Actual: DefaultDaemonContext[uid=41b0cc61-8367-4fa3-9ecb-2a0438b8665d,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home,daemonRegistryDir=/Users/USERNAME/.gradle/daemon,pid=20587,idleTimeout=10800000,daemonOpts=-Xmx3G,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]

    Tried to juggle the java around but cant get it to work

    • Hmmmm, not sure what is going on there, have you tried restarting your computer? Or reinstalling java and then restarting?

  2. When I choose “build.gradle” when adding to project from existing source it loads then I receive this error: “Found java version 11.0.3. Minimum required is 1.8.0_101. Versions 11.0.0 and newer are not supported yet.”
    Now, I have set the project SDK to 10.0.2 instead of 11.0.3 under File -> Project Structure -> Project and applied the changes but, I still apparently is finding the newer version instead of using the version I selected.
    Any help would be appreciated.

    Thanks.

    • Java 8 is recommended, make sure you have jdk 8 installed, you now need an account to download it so I recommend using AdoptOpenJDK because this doesn’t need it.
      You may need to change the boot jdk intellij uses. For help on that click here

  3. After I execute getIntellijRuns, I do not see a client or a server run task. Is there something else I need to do? The forge documentation says I need to first run setupDecompWorkspace, but I don’t see this task in the gradle panel. Any ideas? I’m using 1.14.3.

    • setupDecompWorkspace is for pre 1.13 versions. Did you try restarting intellij? If you run the genIntellijRuns task do you get any errors?

      • No I don’t get any errors. I’ve restarted IntelliJ several times. I noticed in your steps, the genIntellijRuns is in Tasks/Other, but for me it was in Tasks/fg_runs. I don’t know if this implies things are different since you wrote your steps?

        Also, I’m running IntelliJ Community Edition 2017.2. I should probably go ahead and update that but I don’t know if it matters for this problem.

        • They did move the tasks then yeah, but that shouldn’t matter. I just used the latest forge (1.14.4-28.0.23) and it all worked for me. try going in .idea/runConfigurations and delete the run*.xml files, and then rerun genIntellijRuns

          • Any idea where those files might be on a windows 10 machine? I did a search and didn’t find anything.

          • Well I’m officially confused. I switched over to your 1.14 instructions. Upgraded my IntelliJ CE. Started over fresh. I never get the screen where you choose “Use default gradle wrapper” and other settings. But it loads up the project. However, then under the fg_runs task, I only see prepareRuns. I don’t know what that does, but I ran it and still never see genIntellijRuns task.
            Might be time to switch over to eclipse and try that route.

          • It seems like intellij 2019.2 is bugged :/
            Either downgrade or manually run ./gradlew genIntellijRuns in the powershell (or command prompt)

Comments are closed.