This is a lightweight configuration mod that has per-world config (like game rules) that is synced to the client, and a separate client-side config.
For players
Mod configuration menus are square icon buttons in the options screen, like create and quark do. Inside can be groups, click on them to enter, escape to back out. Built in option types are true/false (click to toggle), integers and decimals (scroll both).
For developers
In build.gradle
:
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
modImplementation "com.github.TheTypholorian:config:${project.typho_config_version}"
}
Then in gradle.properties
, you need to add typho_config_version=1.1
(find the latest version in releases tab)
After that, create a RootConfigOptionGroup
for your mod. You don't need to put this anywhere, just create it:
RootConfigOptionGroup root = new RootConfigOptionGroup.Builder().env(EnvType.SERVER).id(Identifier.of(MOD_ID, "root")).icon(new ItemStack(Items.DIRT)).build();
This will create the config button for your mod in the options screen. To add an integer value:
IntConfigOption someIntValue = new IntConfigOption.Builder().parent(root).id("some_int_value").value(16).icon(new ItemStack(Items.DIAMOND)).build();
You can also create a boolean or float option, as well as ranged ints and floats. If you wanted to create a sub group to organize things, it's similar:
ConfigOptionGroup subGroup = new ConfigOptionGroup.Builder().parent(root).id("sub_group").icon(new ItemStack(Items.DIAMOND_SWORD)).build();
Server options are synced from server to client automatically, and you can statically get the values with ConfigOption::get
.