Example config
Show/hide
:
public class ExampleConfig {
public final BooleanOption exampleBoolean = new BooleanOption("exampleBoolean", false);
public ExampleConfig() {
var configPath = FabricLoader.getInstance().getConfigDir().resolve("example-config.json");
// create a root category. For automatic modmenu integration this must be named the same as your mod's modid.
var exampleCategory = OptionCategory.of("example-category");
exampleCategory.add(exampleBoolean);
// versioned
var currentVersion = 1;
var configManager = new VersionedJsonConfigManager(configPath, exampleCategory, currentVersion,
(oldVersion, newVersion, config, json) -> {
// this lambda can be used to convert old config values into new ones
});
// unversioned
//var configManager = new JsonConfigManager(configPath, exampleCategory);
// register the config
AxolotlClientConfig.register(configManager);
// The config will not load automatically.
// Similarly, you can also manually save the config using .save() but the GUI will do that
// for you after an option is changed as well.
configManager.load();
}
}