Skip to content
gegy1000 edited this page May 16, 2017 · 3 revisions

Config

LLibrary makes making a config very easy. It does all the loading and saving for you, the only thing you have to do is some annotation magic!

This has been deprecated in favor of Forge's config system.

Registering

To register the config, you have to call the following method:

ConfigHandler.INSTANCE.registerConfig()

The first argument is the main mod class, the class with the @Mod annotation. If you register the config with the wrong object, it won't work. The second argument is the file to save the config to. If you register the config in the FMLPreInitializationEvent, you can use event.getSuggestedConfigurationFile() to get the default config file location. the file will be created if it doesn't already exist.
The third argument is the config object. This is the only object that can contain the annotations. The registery method will also return the newly made config object.

Annotations

Every field in the config object that should be saved to the config has to annotation with @ConfigEntry. All the values in the annotation are optional.

Name Type Description
name String The config entry name. If empty, the field name will be used
comment String The comment for this config entry
category String The config entry category. If empty, the general category will be used
minValue String The minimal config value of this entry. This is used by integers, floats and doubles
maxValue String The maximal config value of this entry. This is used by integers, floats and doubles
validValues String array A list of valid values. This field is used by all arrays
side Side The side of this config entry. If set to SERVER (default), this entry will be universal

Example

You can find an example of the configs in the config test.

Clone this wiki locally