Creating a config
Creating the Config class
Create a new class like so:
Once created, simply register your fields for the configs you wish to use. These can only public
, non-final
and instance
fields only.
Supported datatypes include:
boolean
,boolean[]
char
int
,int[]
long
,long[]
float
,float[]
double
,double[]
String
,String[]
Enums
Object Objects are used for config nesting/splitting into multiple categories. Just include some
@
Configurable
fields in the nested object instance.
An example of a config is
Registering the Config
Forge
In your mods constructor, add the following:
Fabric
In your mods Initializer class, add the following:
Calling your Config fields
To call your use <YourModInitializerClass>.config.<config_field> where you wish to use it!
Last updated