Buildsystem built on top of ForgeGradle 3.0 for making JAR mods in Minecraft 1.13+
- You need to have at least JDK8 update 92 for recompilation to work, due to a bug in earlier versions of
javac. - You need to have
gitinstalled. - Eclipse Oxygen.3 or later, due to this Eclipse bug.
- Or Intellij
- Copy all the files in this repository into your new project folder.
- Delete the example mod from inside
patches(do not delete thepatchesdirectory itself) and from insidesrc/main/java. - Edit
conf/settings.jsonfor your project. Each setting is described in more detail below. - Run
gradlew setupto decompile and deobfuscate the code. - Run
gradlew eclipseto setup the appropriate Eclipse projects. Do this even if you are planning on using Intellij IDEA. - If you use Eclipse, open Eclipse, and navigate to
File -> Import -> General -> Existing Projects into Workspace. Navigate to and select theprojectssubdirectory, and check your mod project, and optionally the clean (unmodified) project too. - Otherwise, open Intellij IDEA and import the Eclipse project.
Once you have setup the project, you should see a file structure in Eclipse which looks something like this:
- src/main/java This is where all of the MINECRAFT classes go, i.e. classes which you may or may not have modified, but no classes you have added.
- src/main/resources Similar to src/main/java except for non-java files.
- main-java This is where all of the MOD classes go, i.e. the classes which you have added.
- main-resources Similar to main-java except for non-java files.
From outside Eclipse, the file structure looks a little different. However, you should avoid editing these files from outside Eclipse:
- src/main/java The MOD classes
- src/main/resources The MOD resources
- patches Patches your mod has made to the MINECRAFT classes, which can be pushed to public repositories
- projects/<modname>/src/main/java * The MINECRAFT classes
- projects/<modname>/src/main/resources * The MINECRAFT resources
- projects/clean/src/main/java * The unmodified MINECRAFT classes
- projects/clean/src/main/resources * The unmodified MINECRAFT resources
* = ignored by git
- You should be able to run Minecraft directly from within the IDE.
- Every time you checkout a branch which has changed files in the
patchesdirectory, you need to rungradlew setupagain to update the code insrc/main/javainside Eclipse. This will not try to decompile again like it did the first time, so won't take long. - Every time you make changes to MINECRAFT classes and want to push to the public repo, you need to run
gradlew genPatchesto update the patch files in thepatchesdirectory. This takes a few seconds. - When you are ready to create a release, run
gradlew createRelease. This may take longer than the other tasks because it is recompiling the code. Once it is done, your releases can be found in thebuild/distributionsdirectory.
modnamethe name of your mod.modversionthe version your mod is on.mcpconfigthe MCPConfig version you are using.mappingsthe MCP mappings you are using.mcversionthe Minecraft version.pipeline, eitherjoined,clientorserver- whether your mod is to be a client-side-only or server-side-only mod, or to be both and share the same codebase.clientmainthe main class on the client.servermainthe main class on the server.reformatwhether to run Artistic Style on the code to reformat it. Makes the build process a little slower but does mean you can change the formatting options withconf/astyle.cfg.customsrgThe custom tsrg file inside theconf/folder, to override the one in the MCPConfig distribution, used to deobfuscate even newer Minecraft versions.nopatchesIf true, don't apply MCP patches to fix recompile errors.customconstructorsThe customconstructors.txtfile in theconf/folder, to override the one in the MCPConfig distribution, used to deobfuscate even newer Minecraft versions.fernflowerThe custom fernflower package to use to decompile.
1.13 modding is still in its infancy, and there are already known bugs that occur in the decompiled code which do not occur in vanilla. If you care about maintaining vanilla behaviour, then whenever making a change which may modify a certain vanilla class, make sure to weigh up the benefit of modifying said class against the risk that there might be a decompile bug in the class. This situation is constantly improving as 1.13 modding matures, but for now you can at least minimize the effect by distributing as few modified classes as possible.