Registering the Config

Serialization works with any types supported the following libraries:

If that's not sufficient, you can customize those serialization handlers the same way you would if you used them directly.

circle-info

Register the config before you use it, ideally in your mod's init function.

There are three built-in serializers for you to choose from, or you can provide your own.

// Only choose one of these!
AutoConfig.register(ModConfig.class, Toml4jConfigSerializer::new);
AutoConfig.register(ModConfig.class, GsonConfigSerializer::new);
AutoConfig.register(ModConfig.class, JanksonConfigSerializer::new);
circle-exclamation

Last updated