-
Notifications
You must be signed in to change notification settings - Fork 5
Types
Lortseam edited this page Sep 3, 2023
·
12 revisions
Config entries support the following types by default:
boolean-
byte,short,int,long,float,double charjava.lang.String- Any type of array
java.util.Listjava.util.Setjava.util.Map- Any
enumclass java.net.URIjava.net.URLjava.util.UUIDjava.util.regex.Patternjava.util.Filejava.nio.file.Pathjava.awt.Color
net.minecraft.text.TextColornet.minecraft.client.util.InputUtil.Key
me.shedaniel.math.Color
me.shedaniel.clothconfig2.api.ModifierKeyCode
Note: Not all types are supported for the config screen.
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.