Installation

Add the Settings Saver API to your Gradle build as a compile-only dependency, and learn why it must never be bundled in your mod's jar.

Last updated

Steps

By the end of this page your mod compiles against the Settings Saver API. Nothing changes for players who don't have Settings Saver.

Prerequisites#

Steps#

1. Add the repository and the API#

The API jar is dev.xichil.settingssaver:settingssaver-api on https://maven.xichil.dev. Add it as compileOnly:

build.gradle.kts
repositories {
    maven("https://maven.xichil.dev")
}

dependencies {
    // Settings Saver's own jar ships these classes. Never bundle, shade or jar-in-jar them.
    compileOnly("dev.xichil.settingssaver:settingssaver-api:1.0.0")
}
build.gradle
repositories {
    maven { url 'https://maven.xichil.dev' }
}

dependencies {
    compileOnly 'dev.xichil.settingssaver:settingssaver-api:1.0.0'
}

The API has no dependencies and contains no Minecraft or loader classes, so it compiles in any source set, including code shared between loaders (see Build one integration for every loader).

2. Leave your mod metadata alone#

You don't have to declare Settings Saver in fabric.mod.json, mods.toml, neoforge.mods.toml or mcmod.info. Settings Saver finds your integration through a service file in your jar (step 3 of the next page), which works without any loader metadata and without load-order rules.

Don't declare it as a required dependency: your mod should keep working without it.

3. Optional: use the API in tests#

The API is plain Java, so your formats, fixes and mergers can be tested in JUnit without Minecraft. Add the same artifact to the test class path:

build.gradle.kts
dependencies {
    testImplementation("dev.xichil.settingssaver:settingssaver-api:1.0.0")
}

See Test your integration without Minecraft.

Check it worked#

Add an import of dev.xichil.settingssaver.api.v1.ModSettings to any class and build. If it compiles, the dependency resolves. Remove the import again: only your plugin class should reference the API.

Next steps#