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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCategory
(String category) Add a config category.boolean
addConfigurable
(ExtendedConfig<?, ?> e) void
addToConfigDictionary
(ExtendedConfig<?, ?> e) Map<String,
ExtendedConfig<?, ?>> Get the map of config nameid to config.void
initialize
(Collection<IConfigInitializer> configInitializers) Initialize the configs by running builders through all relevant parts.void
Iterate over the given ExtendedConfigs and callConfigurableTypeAction.onRegisterForge(ExtendedConfig)
during theNewRegistryEvent
event.void
Iterate over the given ExtendedConfigs and callConfigurableTypeAction.onRegisterForgeFilled(ExtendedConfig)
during theRegisterEvent
event.void
Iterate over the given ExtendedConfigs to read/write the config and register the given elements This also sets the config of this instance.void
Iterate over the given ExtendedConfigs and callConfigurableTypeAction.onRegisterSetup(ExtendedConfig)
during theFMLCommonSetupEvent
.void
onLoad
(net.minecraftforge.fml.event.config.ModConfigEvent.Loading configEvent) void
onRegistryEvent
(net.minecraftforge.registries.RegisterEvent event) void
onReload
(net.minecraftforge.fml.event.config.ModConfigEvent.Reloading configEvent) <V> void
registerToRegistry
(net.minecraftforge.registries.IForgeRegistry<? super V> registry, ExtendedConfigForge<?, V> config, Callable<?> callback) Register the given entry to the given registry.void
syncProcessedConfigs
(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 theNewRegistryEvent
event. -
loadForgeRegistriesFilled
public void loadForgeRegistriesFilled()Iterate over the given ExtendedConfigs and callConfigurableTypeAction.onRegisterForgeFilled(ExtendedConfig)
during theRegisterEvent
event. -
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)
-