Tutorial 1.15 Episode1

From McJty Modding
Revision as of 10:38, 6 August 2020 by McJty (talk | contribs)
Jump to: navigation, search


In this tutorial the basic principles of modding are explained. You learn how to use the build system. How to update Forge and get the basic mod going.

Useful Links


  • Mod: a mod is a set of Java classes, usually distributed in a jar archive, which is designed to modify the Minecraft game. These days mods no longer directly modify Minecraft code but instead they work through an API that sits on top of Minecraft. Two popular API's (or also called mod loaders) are Forge and Fabric. In this tutorial we focus on modding using Forge.
  • Mappings: Minecraft ships with obfuscated names due to various reasons that are beyond the scope of this tutorial. In order to make the life of modders easiers these names are first translated to SRG names. These are still not human readable but they are standard over different versions of Minecraft (as long as the signature of the method doesn't change and as long as it isn't a new method/class that didn't exist before). Finally SRG names are mapped to human readable names. This process is automated by the gradle setup so you usually don't have to worry about it except for picking the appropriate version of the mappings.
  • Gradle: Gradle is the build tool that is used to setup a mod project. It integrates well with both IntelliJ and Eclipse.
  • Registration: Almost all Minecraft objects are represented by a registry. This includes blocks, tile entities, entities, items, biomes, dimensions, potions and so on. By using this registry it is possible for mods to add their own instances of these objects and by doing that extend the base game. Registration of these objects happens in a specific manner through events.
  • Client/Server: Even when you run Minecraft in single player mode there is still an internal server that runs. When making a Minecraft mod you have to be aware of this dual sided nature at all times. A very solid explanation on this can be found in the official Forge documentation: https://mcforge.readthedocs.io/en/1.15.x/concepts/sides/

Project Setup

Setup of Minecraft mod projects happens with gradle. The build.gradle file (https://github.com/McJty/YouTubeModding14/blob/master/build.gradle) is the most important file for that. In that file you setup dependencies, the version of Forge that you are using, the version of the mappings that you are using and so on.

Mod Setup

For your actual mod you need minimum three files (besides build.gradle):

  • MyTutorial.java: this is the actual main mod class (https://github.com/McJty/YouTubeModding14/blob/master/src/main/java/com/mcjty/mytutorial/MyTutorial.java) and it's the first thing that fires up when your mod is activated. In this class we first register our client and server configs (more on configs in a later episode). We also call our Registration.init() to fire up the registration system for our mod and we register two callbacks that are automatically called at the right time (after registration) by Forge. The reason for the two callbacks is that one is server-side (is fired on the server and client) and one is client-side only (for things related to rendering).