public class ConfigManager
extends java.lang.Object
Constructor and Description |
---|
ConfigManager() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Class<?>[] |
getModConfigClasses(java.lang.String modid) |
static boolean |
hasConfigForMod(java.lang.String modid) |
static void |
load(java.lang.String modid,
Config.Type type)
Bounces to sync().
|
static void |
loadData(ASMDataTable data) |
static void |
sync(java.lang.String modid,
Config.Type type)
Synchronizes configuration data between the file on disk, the
Configuration object and the annotated
mod classes containing the configuration variables. |
public static void loadData(ASMDataTable data)
public static void load(java.lang.String modid, Config.Type type)
public static void sync(java.lang.String modid, Config.Type type)
Configuration
object and the annotated
mod classes containing the configuration variables.
When first called, this method will try to load the configuration from disk. If this fails, because the file
does not exist, it will be created with default values derived from the mods config classes variable default values
and comments and ranges, as well as configuration names based on the appropriate annotations found in @Config
.
Note, that this method is being called by the FMLModContaier
, so the mod needn't call it in init().
If this method is called after the initial load, it will check whether the values in the Configuration object differ
from the values in the corresponding variables. If they differ, it will either overwrite the variables if the Configuration
object is marked as changed (e.g. if it was changed with the ConfigGui) or otherwise overwrite the Configuration object's values.
It then proceeds to saving the changes to disk.modid
- the mod's ID for which the configuration shall be loadedtype
- the configuration type, currently always Config.Type.INSTANCE
public static java.lang.Class<?>[] getModConfigClasses(java.lang.String modid)
public static boolean hasConfigForMod(java.lang.String modid)