-
Notifications
You must be signed in to change notification settings - Fork 0
Examples
zerocool edited this page Jan 11, 2026
·
3 revisions
(You can also look at my mod Lifed for more)
A simple config that will store one int with a comment above it
import z3roco01.composed.annotation.*;
public class ExampleConfig {
@Comment(comment = "should we kill them all")
@ConfigProperty
public boolean killEveryone = true;
}To then load and save the config:
import z3roco01.composed.file.ConfigFile;
public class ModMain implements ModInitializer {
public static final ExampleConfig config = new ExampleConfig();
@Override
public void onInitialize() {
// need to catch exceptions that load and store can produce
try {
// load in the values or store defaults
ConfigFile.load("./config/example.conf", config);
}catch(IOException | IllegalAccessException e) {
throw new RuntimeException(e);
}
// do stuff with the config values
if(config.killPlayers) {
killEveryone();
}
}
}The config file .minecraft/config/example.conf will look like:
# should we kill them all
killEveryon=true