Now it is time to register your config file so that Forge can create and read the config file. Doing do, you simply call <code>ModLoadingContext.get().registerConfig</code> and pass in, the <code>ModConfig.Type</code>, the <code>GENERAL_SPEC</code> from your config file, and the name of the config file (make sure you include <code>.toml</code> as well. Like so:
Now it is time to register your config file so that Forge can create and read the config file. Doing do, you simply call <code>ModLoadingContext.get().registerConfig</code> and pass in, the <code>ModConfig.Type</code>, the <code>GENERAL_SPEC</code> from your config file, and the name of the config file (make sure you include <code>.toml</code> as well. Like so:
NOTE: Forge will only update the values of your config fields in code after the registry events are finished. Therefore, only attempt to read the config values after the registry events are completed. (FMLCommonSetupEvent and later is safe)
+
'''NOTE:''' Forge will only update the values of your config fields in code after the registry events are finished. Therefore, only attempt to read the config values after the registry events are completed. (FMLCommonSetupEvent and later is safe)
The ModConfig.Type determines where your config files goes and its behavior. While COMMON is generally used the most, the other config types do have specific uses. A simple summary is:
The ModConfig.Type determines where your config files goes and its behavior. While COMMON is generally used the most, the other config types do have specific uses. A simple summary is: