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

Supported Types

Config entries support the following types by default:

  • boolean
  • byte, short, int, long, float, double
  • char
  • java.lang.String
  • Any type of array
  • java.util.List
  • java.util.Set
  • java.util.Map
  • Any enum class
  • java.net.URI
  • java.net.URL
  • java.util.UUID
  • java.util.regex.Pattern
  • java.util.File
  • java.nio.file.Path
  • java.awt.Color

Minecraft

  • net.minecraft.text.TextColor
  • net.minecraft.client.util.InputUtil.Key

Mods

  • me.shedaniel.math.Color
  • me.shedaniel.clothconfig2.api.ModifierKeyCode

Note: Not all types are supported for the config screen.

Custom Types

You can also register custom types using type serializers and object mapper factories. This makes use of the underlying library Configurate. Type serializers and object mapper factories then have to be registered in the config options.

If you created the type yourself, just annotate the class with @ConfigSerializable. That's it.

@ConfigSerializable
public class MyType {

    private int someNumber;
    private String someString;

    // ...

}

The behavior of this function can be changed with object mapper factories. See Configurate's wiki page on how to configure those.

For more complex types or classes you don't have control of, you can use type serializers. Detailed instructions on how to create them can be found on Configurate's wiki page.

Clone this wiki locally