A multi-platform Minecraft mod template for Fabric and NeoForge, using Stonecutter for multiversion and multiloader code. This is the Java-only version adapted from KikuGie's Elytra Trims rewrite following major Stonecutter feature updates.
This template is as "batteries included" as possible. If you don't like this, it's not the right template for you (Alternative Templates).
- Single codebase for both Fabric and NeoForge
- Single codebase for multiple Minecraft versions
- CI/CD with GitHub Actions for automated builds and releases
- Separate build scripts for each platform
- Knowledge of Fabric and NeoForge
- Suitable IDE
- Java 21 or higher
- Git
git clone https://github.com/rotgruengelb/stonecutter-mod-template.git
cd stonecutter-mod-templateImport the project as a Gradle project in your preferred IDE (e.g., IntelliJ IDEA, Eclipse).
The IntelliJ plugin adds comment syntax highlighting and completion, a button to switch the active version, alongside other utilities.
Edit gradle.properties to set your mod's metadata:
| Property | Description | Example |
|---|---|---|
mod.id |
Your mod’s identifier (lowercase, no spaces) | modtemplate |
mod.name |
Display name of your mod | Mod Template |
mod.group |
Java package group | com.example |
mod.version |
Mod version number | 0.1.0 |
mod.channel_tag |
Optional release channel tag | -alpha.0 |
mod.authors |
Name of the author(s), comma-separated | AuthorName |
mod.contributors |
Contributor names, comma-separated | ContributorName, AnotherContributorName |
mod.license |
License type | MIT |
mod.description |
Short mod description | Example Description |
mod.sources_url |
Link to your source code repository | https://github.com/rotgruengelb/stonecutter-mod-template |
mod.homepage_url |
Mod homepage or info page | https://github.com/rotgruengelb/stonecutter-mod-template |
mod.issues_url |
Link to issue tracker | https://github.com/rotgruengelb/stonecutter-mod-template/issues |
mod.discord_url |
Link to a Discord invite | https://discord.gg/aunYJB4wz9 |
Dependencies/Properties that are specific to a version/loader
are defined in gradle.properties as [VERSIONED] then set in versions/{version}-{loader}/gradle.properties.
Rename the com.example.modtemplate package in
src/main/java/ to match your mod.group and mod.id.
Rename these files to match your mod.id:
src/main/resources/modtemplate.accesswidenersrc/main/resources/modtemplate.mixins.json
Replace and src/main/resources/assets/icon.png and .idea/icon.png with the mods icon.
Stonecutter allows multiple Minecraft versions and loaders in a single codebase.
Configure Stonecutter in stonecutter.gradle.kts and settings.gradle.kts.
Example of platform-specific code using Stonecutter comments:
//? if fabric {
/*fabricOnlyCode();*/
//?} else {
neoforgeOnlyCode();
//?}Verson-specific code works similarly:
//? if 1.21.7 {
LOGGER.info("hello 1.21.7!");
//?} else {
/*LOGGER.info("hello from any other version!");
*///?}For more details, read the Stonecutter documentation.
The Gradle plugins of the respective platform should provide run configurations. If not, you can run the server and client with the respective Gradle tasks. Be careful to run the correct task for the selected Stonecutter platform and Minecraft version.
The template uses a platform abstraction pattern to keep shared code loader-agnostic:
- Shared code goes in
com.example.modtemplate(no platform dependencies) - Platform-specific code goes in
com.example.modtemplate.platform.{fabric|neoforge} - The
Platforminterface provides loader-specific functionality to shared code
To add dependencies for a specific platform, modify the platform block in the respective build.gradle.kts file.
The declared dependencies are automatically added to the metadata file for the loader and when publishing the mod to
mod hosting platforms.
Important: This does not replace the dependencies block!
platform {
loader = "fabric" // or "neoforge"
dependencies {
required("my-lib") {
slug("my-lib") // Mod hosting platform slug (here the slug is the same on both Modrinth and CurseForge)
versionRange = ">=${prop("deps.my-lib")}" // version range (for fabric.mod.json)
forgeVersionRange =
"[${prop("deps.my-lib")},)" // version range (for neoforge mods.toml), uses Maven version range syntax
}
}
}Run Fabric data generation to create recipes, tags, and other data:
./gradlew :1.21.7-fabric:runDatagenGenerated files appear in src/main/generated/.
The current setup uses Fabric data generation for both platforms.
- Stonecutter Documentation
- NeoForge Documentation
- Fabric Documentation
- Pre-commit
- Git Source Control
- Conventional Commits
- Semantic Versioning
- Your Modrinth PAT
- Your CurseForge API Tokens
- GitHub Actions Documentation
- Gradle Documentation
For help and support, consider the following places:
- "Kiku's Realm" Discord Server for Stonecutter-related questions.
- "Cascading Colors" (My) Discord Server for questions about this template and its setup.
- "The NeoForge Project" Discord Server for NeoForge-related questions.
- "The Fabric Project" Discord Server for Fabric-related questions.
This template is provided under the MIT License.
Check LICENSE for details.
- Based on murderspagurder/mod-template-java
- Adapted from KikuGie's Elytra Trims setup
- Uses Stonecutter by KikuGie