I don't know if there is any documentation, but at least half the mods you play with are configurable - you find their source code and look at it.
there is really no way to explaining this other than dumping a bit of code:
public class OptionsHolder
{
public static class Common
{
private static final int defaultInt1 = 37;
private static final boolean defaultBool1 = true;
public final ConfigValue<Integer> Int1;
public final ConfigValue<Boolean> Bool1;
public Common(ForgeConfigSpec.Builder builder)
{
builder.push("category1");
this.Int1 = builder.comment("This is a nice description of your option. Make it a lot longer than this. Max is 60, default is 37. Enjoy...")
.worldRestart()
.defineInRange("Short but readable name", defaultInt1, 1, 60);
this.Bool1 = builder.comment("asdasd as asd asd asd asdas aasd as asd asd. asd as asd asd. asdasdad asd.")
.define("Short but readable name 2", defaultBool1);
builder.pop();
}
}
public static final Common COMMON;
public static final ForgeConfigSpec COMMON_SPEC;
static //constructor
{
Pair<Common, ForgeConfigSpec> commonSpecPair = new ForgeConfigSpec.Builder().configure(Common::new);
COMMON = commonSpecPair.getLeft();
COMMON_SPEC = commonSpecPair.getRight();
}
}
then, in your main class constructor you say:
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, OptionsHolder.COMMON_SPEC);
and that's it. the game will create the config file. players will edit it and you read values by saying OptionsHolder.COMMON.Bool1.get().
this creates a single config file in config folder. you can have separate server config (created in world save folder) and client config (in config folder) by creating two small static classes inside the big one (same file) and duplicating that one line in the main class constructor. or you can have just the server config or just the client config.