Introduction
Cloche Graft (org.redlance.graft) is a Gradle plugin built on top of Terrarium Cloche that makes it practical to maintain a single multi-loader, multi-version Minecraft project — and package it into one universal JAR when you want to.
Both PlayerAnimationLibrary and Emotecraft use Cloche and Graft to build Fabric and NeoForge across multiple Minecraft 26.x releases from one Gradle module without duplicating subprojects or juggling preprocessor comments.
Cloche vs. Graft
| Layer | Role |
|---|---|
| Terrarium Cloche | The underlying Minecraft toolchain plugin (replacing Fabric Loom, ModDevGradle, and Architectury Loom). Compiles multiple loaders and Minecraft versions in one Gradle project using Kotlin-Multiplatform-style target hierarchies and bytecode API stub intersections. |
| Cloche Graft | An opinionated helper layer on top of Cloche that adds a clean 2D (version × loader) directory layout, KMP-style intermediate shared(...) layers, native Fabric class-tweaker interface injection, vanillaLibrary modules, and a ShadowJar-based universal JAR combiner with ASM bytecode and mixin validation. |
Because Cloche itself currently has very little public documentation, the first section of these docs covers Cloche's fundamentals — how targets, API stubs, dependencies, runs, and ClassTweakers work under the hood — before moving on to Graft's DSL and universal JAR pipeline.
Why Cloche + Graft?
Traditional multi-loader setups (Architectury, MultiLoader Template, Stonecutter) solve different halves of the problem with trade-offs:
- One Gradle subproject per loader duplicates
build.gradleboilerplate, multiplies Gradle configuration time, and still requires Stonecutter or git branches to target more than one Minecraft version. - Stonecutter / preprocessor templates switch the entire workspace to one version at a time, so breaking changes on another version only surface when you switch or run CI.
Cloche compiles every loader and every Minecraft version simultaneously in a single project and computes a compile-time API stub (the bytecode intersection of all target Minecraft JARs) for shared code. If Minecraft changes a method signature between 26.2 and 26.3, your common code fails to compile immediately in the IDE rather than crashing at runtime on one version.
Graft builds directly on that foundation to provide:
- Predictable 2D layout (
src/main,src/fabric,src/neoforge,src/<ver>/{common,fabric,neoforge},src/test). - Intermediate
shared(...)layers (likesrc/pre263orsrc/mc262Plus) so code shared by a subset of versions is never copy-pasted. - Universal JAR combining (
combine) with automatic merging offabric.mod.json,META-INF/neoforge.mods.toml,META-INF/services/**, Jar-in-Jar descriptors, Access Wideners, and Access Transformers. - Compile-time safety checks via ASM bytecode comparison (catching subtle issues like
static finalconstant inlining across Minecraft versions) and*.mixins.json"plugin"validation. - Native Fabric
class-tweakersupport so.classtweakerfiles,classTweaker v1 officialheaders,inject-interface,transitive-inject-interface, andextendable classwork out of the box.
Where to start
- New to Cloche? Read Cloche Fundamentals first to understand targets, API stubs, dependencies, and ClassTweakers.
- Ready to set up a project? Follow Installation and Project Layout.
- Shipping one JAR for multiple versions or loaders? See Shared Layers, Universal JARs, and Validation & SPI.
- Looking up a specific property or method? Jump straight to the DSL Reference.
Source and license
Cloche Graft is maintained by the PlayerAnimationLibrary team under the MIT license. Source code lives at PlayerAnimationLibrary/cloche-graft.