Minecraft 1.14/1.15 modding with Forge – 2 – Setting up a basic mod

Hello everyone and welcome to part 2 of Minecraft 1.14/1.15 modding with forge, today I am going to show how to make a mod that is detected and loaded by Forge.

First, we need to create the main mod class.

  1. Create a package in the “src/main/java” source folder. I will call it com.suppergerrie2.tutorial”. But you should think of your own name, I will be referring to this package as the mod package. This package will contain all of the classes we are going to create. Your package name should adhere to the java conventions.
  2. Create a class in the mod package and I will call it TutorialMod I will be referring to this class as the Main class. This class will be the entry point of the mod. Everything will start here.

The basic files are now set up so let’s start coding!
In the Main class add 1 public static final String variable: MOD_ID, this will be the id of your mod, it can be whatever you want, but it has to be all lowercase (This is the exact regex used to check if it is valid: “^[a-z][a-z0-9_-]{1,63}$”. Which basically means: start with a lowercase letter, then at least 1 but up to 63 more of the following chars: a to z, 0 to 9 _ and – ).

In the Main class add an @Mod annotation above the class declaration. This will tell forge that this is a mod file. @Mod requires the modid as an attribute.
It should now look like this:

We also need to add a couple of files to the “src/main/resources” folder.
Create a file called pack.mcmeta. In this file, you specify some of the metadata for the mods resources. It follows the exact same format as for 1.13:

Create a new folder with the name META-INF. In this folder create a file named mods.toml. The mods.toml will tell forge which mods exist and some things like the name, modId, version etc. You should look into the toml format to understand how the file works. But the example from forge shows you a lot. We don’t need everything in that example, we only need to specify:

  • The modloader
  • The loader version
  • The mods we are making, which need to contain:
    • The modid (Needs to be the same as in the @Mod annotation
    • The version
    • The display name
    • The description

Your mods.toml file should look something like this:

This is enough for forge to load the mod, to check if it loaded you can click on Mods and see if your mod is in there.

Screenshot of the modslist with the tutorial mod loaded

Next time we will add a custom item, I hope to see you next time!
I also made a github repository for this tutorial.
And as always, 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!

Till next time!


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


  1. After making all of the files to build the mod I took the jar file and put in /run/mods/ then launched the game with ‘gradlew runClient’ and got this error after it loaded:

    The Mod FIle /home/[mypc]/MODDING/mpf/run/mods/infbi-b.0.1.jar has mods that were not found

    Any advice on how to solve this issue will be much appreciated

    • You built the mod using “gradlew build” right? It may also conflict because if you put it in the dev env it will load twice (from the source files, and from the jar)

  2. I followed this tutorial, however upon running runClient, no mod was loaded. So I then tried building the project and placed the jar file in the run/mods folder, then ran runClient. This prompted the error “this mod is not valid”. I checked the log files and I found “.jar is missing mods.toml file”. Which is confusing because I do have that file, and it is in the resources/META_INF folder. any ideas?

  3. So I looked up the project on github and found the gradle.build file which I think is what you need to build the src/main/java files into a jar file which you then put in your mods folder. How do I look up which version of minecraft I have? I installed the minecraftforge.net 1.14.4-28.0.29 so that I could use mods. But when I try to use your mod it says that it is for an older version of forge. There is no way to use mods in vanilla is there?

    • The build.gradle should say what version was used when developing (check the dependencies). The mods.toml actually says what versions it is compatible with. This line says it is only compatible with forge version 26.*.*.

  4. so you don’t need to import net.minecraft.fml.common.Mod or com.suppergerrie2.tutorial.* to get the MOD_ID variable and the use of @Mod ? Or you just did’nt put them in your tutorial because for you people wich are reading this know how to use java ? wich is a dumb way to think.

    • Not sure what you mean? com.suppergerrie2.tutorial.* is the package name I use, you should use your own package names.

    • Yeah I needed both of those, may update code above to this

      package supper;

      import net.minecraftforge.fml.common.Mod;
      * The main class of the mod, this is the class that looks like a mod to forge.
      public class TutorialMod {

      * The modid of this mod, this has to match the modid in the mods.toml and has to be in the format defined in {@link net.minecraftforge.fml.loading.moddiscovery.ModInfo}
      public static final String MOD_ID = “stutorialmod”;


      • I dont add the package and imports because that makes the code longer than needed to understand. Any basic IDE can import it for you and package stuff is basic java 😀

        • I was definitely lost here too. IntelliJ IDEA didn’t add those two initial lines for me, and the mod didn’t work. Granted my java is very (very) rusty. Considering it’s two lines though, seems to make sense to add them so it’s clear to future readers.

Comments are closed.