Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ryanhcode/sable/llms.txt

Use this file to discover all available pages before exploring further.

Sable Companion is a separate library published at github.com/ryanhcode/sable-companion that provides a minimal API surface for mods that want to interact with Sable without declaring a hard compile-time dependency on it. When Sable is not present at runtime, your mod continues to load normally — the companion stubs are simply unused. The current version used by Sable itself is 1.6.0 (see sable_companion_version in Sable’s gradle.properties). Use the same version your target Sable release depends on to guarantee API compatibility.

When to use Sable Companion

Use Sable Companion when your mod wants to optionally support Sable — for example, to make your blocks behave correctly on sub-levels if Sable happens to be installed, without requiring users to also install Sable.If your mod fundamentally requires Sable to function (e.g. it registers sub-levels or drives the physics pipeline), declare a full modImplementation dependency on Sable directly so the dependency is enforced at launch.

Adding the dependency

Sable Companion is available under the group dev.ryanhcode.sable-companion. Because it is a compile-only dependency, it is not bundled into your mod jar — players do not need to install Companion separately.
dependencies {
    compileOnly "dev.ryanhcode.sable-companion:sable-companion:1.6.0"
}
Replace 1.6.0 with the version that matches the Sable release you are targeting.

Runtime guard

Because Sable Companion is a compile-only dependency, you must guard any code paths that call companion APIs behind a runtime check for Sable’s presence. On both loaders the pattern is the same: check whether the sable mod is loaded before invoking any Sable-specific logic.
if (ModList.get().isLoaded("sable")) {
    SableCompat.register(); // your class that calls companion APIs
}
Keep all Sable Companion API calls in a separate class that is only referenced inside the runtime guard. If the JVM attempts to load a class that references Companion types before the guard runs, you will get a NoClassDefFoundError even though Companion is on the compile classpath.

Build docs developers (and LLMs) love