This project provides a Gradle project template that can compile mods for multiple modloaders using a common sourceset. This project does not require any third party libraries or dependencies. If you have any questions or want to discuss the project join our Discord.
This guide will show how to import the MultiLoader Template into IntelliJ IDEA. The setup process is roughly equivalent to setting up the modloaders independently and should be very familiar to anyone who has worked with their MDKs.
- Clone or download this repository to your computer.
- Configure the project by editing the
gradle.propertiesfile. - Configure the
build.ymlandpublish.ymlfiles with the proper name and link. - Configure the mod id in the neoforge
build.gradlefile in the mods block. - Open the template's root folder as a new project in IDEA. This is the folder that contains this README file and the gradlew executable.
- If your default JVM/JDK is not Java 21 you will encounter an error when opening the project. This error is fixed by going to
File > Settings > Build, Execution, Deployment > Build Tools > Gradle > Gradle JVMand changing the value to a valid Java 21 JVM. You will also need to set the Project SDK to Java 21. This can be done by going toFile > Project Structure > Project SDK. Once both have been set open the Gradle tab in IDEA and click the refresh button to reload the project. - Configure the packages and classes in the
srcfolder to match your mod. - Open your Run/Debug Configurations. Under the Application category there should now be options to run NeoForge and Fabric projects. Select one of the client options and try to run it.
- Assuming you were able to run the game in step 7 your workspace should now be set up.
When using this template the majority of your mod is developed in the Common project. The Common project is compiled against the vanilla game and is used to hold code that is shared between the different loader-specific versions of your mod. The Common project has no knowledge or access to ModLoader specific code, apis, or concepts. Code that requires something from a specific loader must be done through the project that is specific to that loader, such as the NeoForge or Fabric project.
Loader specific projects such as the NeoForge and Fabric project are used to load the Common project into the game. These projects also define code that is specific to that loader. Loader specific projects can access all of the code in the Common project. It is important to remember that the Common project can not access code from loader specific projects.
While the MultiLoader Template includes support for many platforms and loaders you can easily remove support for the ones you don't need. This can be done by deleting the subproject folder and then removing it from the settings.gradle file. For example if you wanted to remove support for Forge you would follow the following steps.
- Delete the subproject folder. For example, delete
MultiLoader-Template/forge. - Remove the project from
settings.gradle. For example, removeinclude("forge").