-
Notifications
You must be signed in to change notification settings - Fork 0
Loading Storing a configuration file
zerocool edited this page Jan 9, 2026
·
2 revisions
Once you have a configuration class, you can then load/store it using th ConfigFile class.
To load it when your mod starts, you could do something like this:
public class Mod 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, this will also store defaults on first time*
// All paths are relative to the .minecraft folder
ConfigFile.load("./config/example.conf", config);
}catch(IOException | IllegalAccessException e) {
throw new RuntimeException(e);
}
/*
Do stuff here
*/
}
}