https://github.com/sinytra/multiloader-template
Multi-Loader mod dev template set up using the Fabric API on both Forge and Fabric
https://github.com/sinytra/multiloader-template
Last synced: 8 months ago
JSON representation
Multi-Loader mod dev template set up using the Fabric API on both Forge and Fabric
- Host: GitHub
- URL: https://github.com/sinytra/multiloader-template
- Owner: Sinytra
- License: cc0-1.0
- Created: 2023-08-01T22:21:26.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-08-03T20:37:04.000Z (almost 3 years ago)
- Last Synced: 2025-10-12T00:25:50.293Z (8 months ago)
- Language: Java
- Homepage:
- Size: 83 KB
- Stars: 17
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MultiLoader Template
This project provides a Gradle project template that can compile mods for both Forge and Fabric using a common
sourceset, set up to use the Fabric API and its Forge port to minimize the amount of platform-dependant mod code.
This allows you to use Fabric API on both platforms with full api compatibility.
If you have any questions or want to discuss the project, feel free to create a post
on [GitHub Discussions](https://github.com/Sinytra/MultiLoader-Template/discussions).
This template is based on Jared's [MultiLoader Template](https://github.com/jaredlll08/MultiLoader-Template).
### Dependencies
Mods created using this template require the [Forgified Fabric API](https://github.com/Sinytra/ForgifiedFabricAPI).
Alternatively, mod authors may choose to ship select API modules as part of their mod jar, eliminating the dependency.
## Getting Started
## IntelliJ IDEA
This guide will show how to import the MultiLoader Template into IntelliJ IDEA. The setup process is roughly equivalent
to setting up Forge and Fabric independently and should be very familiar to anyone who has worked with their MDKs.
1. Clone or download this repository to your computer.
2. Configure the project by editing the `group`, `mod_name`, `mod_author`, and `mod_id` properties in
the `gradle.properties` file. You will also need to change the `rootProject.name` property in `settings.gradle`,
this should match the folder name of your project, or else IDEA may complain.
3. 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.
4. If your default JVM/JDK is not Java 17 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 JVM`and changing the value
to a valid Java 17 JVM. You will also need to set the Project SDK to Java 17. This can be done by going
to `File > Project Structure > Project SDK`. Once both have been set open the Gradle tab in IDEA and click the
refresh button to reload the project.
5. Open the Gradle tab in IDEA if it has not already been opened. Navigate
to `Your Project > Common > Tasks > vanilla gradle > decompile`. Run this task to decompile Minecraft.
6. Open the Gradle tab in IDEA if it has not already been opened. Navigate
to `Your Project > Forge > Tasks > forgegradle runs > genIntellijRuns`. Run this task to set up run configurations
for Forge.
7. Open your Run/Debug Configurations. Under the Application category there should now be options to run Forge and
Fabric projects. Select one of the client options and try to run it.
8. Assuming you were able to run the game in step 7 your workspace should now be set up.
### Eclipse
While it is possible to use this template in Eclipse it is not recommended. During the development of this template
multiple critical bugs and quirks related to Eclipse were found at nearly every level of the required build tools. While
we continue to work with these tools to report and resolve issues support for projects like these are not there yet. For
now Eclipse is considered unsupported by this project. The development cycle for build tools is notoriously slow so
there are no ETAs available.
## Development Guide
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 access to the Fabric API and Fabric Loader classes, but does not have a loader set up.
The Forge project has access to the ported versions of FAPI and fabric loader, which are fully api-compatible with
upstream. However, their implementations differ, therefore you should avoid using any kind of internal code.
Code that requires something from a specific loader (such as entrypoints) must be done through the project that is
specific to that loader, such as the Forge or Fabric project.
Loader specific projects such as the Forge 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.