Package org.cyclops.cyclopscore.config
Class ConfigHandler
java.lang.Object
org.cyclops.cyclopscore.config.ConfigHandler
Create config file and register items and blocks from the given ExtendedConfigs.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCategory(String category) Add a config category.booleanaddConfigurable(ExtendedConfig<?, ?> e) voidaddToConfigDictionary(ExtendedConfig<?, ?> e) Map<String,ExtendedConfig<?, ?>> Get the map of config nameid to config.voidinitialize(Collection<IConfigInitializer> configInitializers) Initialize the configs by running builders through all relevant parts.voidIterate over the given ExtendedConfigs and callConfigurableTypeAction.onRegisterForge(ExtendedConfig)during theNewRegistryEventevent.voidIterate over the given ExtendedConfigs and callConfigurableTypeAction.onRegisterForgeFilled(ExtendedConfig)during theRegisterEventevent.voidIterate over the given ExtendedConfigs to read/write the config and register the given elements This also sets the config of this instance.voidIterate over the given ExtendedConfigs and callConfigurableTypeAction.onRegisterSetup(ExtendedConfig)during theFMLCommonSetupEvent.voidonLoad(net.minecraftforge.fml.event.config.ModConfigEvent.Loading configEvent) voidonRegistryEvent(net.minecraftforge.registries.RegisterEvent event) voidonReload(net.minecraftforge.fml.event.config.ModConfigEvent.Reloading configEvent) <V> voidregisterToRegistry(net.minecraftforge.registries.IForgeRegistry<? super V> registry, ExtendedConfigForge<?, V> config, Callable<?> callback) Register the given entry to the given registry.voidsyncProcessedConfigs(net.minecraftforge.fml.config.ModConfig config, boolean reload) Sync the config values that were already loaded.
-
Constructor Details
-
ConfigHandler
-
-
Method Details
-
initialize
Initialize the configs by running builders through all relevant parts.- Parameters:
configInitializers- A collection of additional initializers to run the config builders through.
-
onLoad
public void onLoad(net.minecraftforge.fml.event.config.ModConfigEvent.Loading configEvent) -
onReload
public void onReload(net.minecraftforge.fml.event.config.ModConfigEvent.Reloading configEvent) -
addConfigurable
-
addToConfigDictionary
-
loadModInit
public void loadModInit()Iterate over the given ExtendedConfigs to read/write the config and register the given elements This also sets the config of this instance. This is called during mod construction. -
loadForgeRegistries
public void loadForgeRegistries()Iterate over the given ExtendedConfigs and callConfigurableTypeAction.onRegisterForge(ExtendedConfig)during theNewRegistryEventevent. -
loadForgeRegistriesFilled
public void loadForgeRegistriesFilled()Iterate over the given ExtendedConfigs and callConfigurableTypeAction.onRegisterForgeFilled(ExtendedConfig)during theRegisterEventevent. -
loadSetup
public void loadSetup()Iterate over the given ExtendedConfigs and callConfigurableTypeAction.onRegisterSetup(ExtendedConfig)during theFMLCommonSetupEvent. -
addCategory
Add a config category.- Parameters:
category- The category to add.
-
syncProcessedConfigs
public void syncProcessedConfigs(net.minecraftforge.fml.config.ModConfig config, boolean reload) Sync the config values that were already loaded. This will update the values in-game and in the config file.- Parameters:
config- The mod config that is being loaded.reload- If we are reloading, otherwise this is an initial load.
-
getDictionary
Get the map of config nameid to config.- Returns:
- The dictionary.
-
registerToRegistry
public <V> void registerToRegistry(net.minecraftforge.registries.IForgeRegistry<? super V> registry, ExtendedConfigForge<?, V> config, @Nullable Callable<?> callback) Register the given entry to the given registry. This method will safely wait until the correct registry event for registering the entry.- Type Parameters:
V- The entry type.- Parameters:
registry- The registry.config- The config.callback- A callback that will be called when the entry is registered.
-
onRegistryEvent
public void onRegistryEvent(net.minecraftforge.registries.RegisterEvent event)
-