Skip to main content

Cloche Fundamentals

Terrarium Cloche is a Gradle plugin for building Minecraft mods across multiple mod loaders (Fabric, NeoForge, Forge) and multiple Minecraft versions inside a single Gradle project.

Instead of splitting your mod into :common, :fabric, and :neoforge subprojects — each with its own toolchain plugin — Cloche models loaders and versions as targets inside one Gradle project, inspired by Kotlin Multiplatform (kotlin { jvm(); js(); commonMain }).

The core idea in 30 seconds​

In a Cloche project:

  1. You declare leaf targets (fabric, neoforge, forge), each pinned to a specific Minecraft version and loader version.
  2. You declare common targets (common, or named common("...") intermediates) that hold code shared across some or all leaf targets.
  3. You connect them into a directed acyclic graph (DAG) with dependsOn(...).
  4. For every common target, Cloche computes the intersection of Minecraft and loader APIs available across all leaf targets that depend on it, generates a compile-only API stub JAR, and compiles the common source set against that stub.
  5. Each leaf target compiles its own sources alongside the compiled common classes, applies mixins / access wideners / access transformers, and outputs a ready-to-run mod JAR.

What this section covers​

  • Targets & API Stubs — How common, fabric, neoforge, dependsOn(...), singleTarget, and Cloche's GenerateStubApi intersection work.
  • Dependencies, Runs & Publishing — ClocheDependencyHandler, repositories, fabricApi(...), include(...), client/server runs, IntelliJ sync, and Gradle Module Metadata publishing.
  • ClassTweaker, Mixins & Known Quirks — Access Wideners, Access Transformers, Mixin configuration, unobfuscated Minecraft 26.x namespaces, and Cloche 0.19.x edge cases (and how Graft handles them).
Cloche version

These docs reflect Terrarium Cloche 0.19.13 (with minecraft-codev 0.6.x–0.9.x) targeting unobfuscated Minecraft 26.1+ as well as earlier mapped versions.