Skip to content
Lortseam edited this page Sep 3, 2023 · 15 revisions

The ConfigOptions class contains several options:

public class MyConfig extends Config {

    public MyConfig() {
        super(ConfigOptions.mod("modid")
                .branch(/*...*/)
                .typeSerializers(/*...*/)
                .objectMapperFactory(/*...*/)
                .fileHeader(/*...*/));
    }

}

branch

The branch determines the location of the config file. If your mod has multiple configs, each one needs a unique branch. The default branch is the empty branch, the config file path is .minecraft/config/modid.conf.

Example
ConfigOptions.mod("modid").branch(new String[]{"branch", "config"})

In this case, the config file path is .minecraft/config/modid/branch/config.conf.

typeSerializers and objectMapperFactory

Type serializers and object mapper factories can be used to support custom entry types. See Types for more information.

fileHeader

The file header is a comment added to the top of the config file.


NEXT: Structure

Clone this wiki locally