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.
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#
- A mod project that builds with Gradle.
- Java 8 or newer as the compile target. The API is compiled for Java 8, so code that uses it runs on every Minecraft version from 1.7.10 to 26.3.
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:
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")
}
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:
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#
- Your first integration: write the plugin class and the service file.
- An optional dependency: why your mod can't crash when Settings Saver is missing.