Class ConfigHandler

java.lang.Object
org.cyclops.cyclopscore.config.ConfigHandler

public class ConfigHandler extends Object
Create config file and register items and blocks from the given ExtendedConfigs.
  • Constructor Details

    • ConfigHandler

      public ConfigHandler(ModBase mod)
  • Method Details

    • initialize

      public void initialize(Collection<IConfigInitializer> configInitializers)
      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.neoforged.fml.event.config.ModConfigEvent.Loading configEvent)
    • onReload

      public void onReload(net.neoforged.fml.event.config.ModConfigEvent.Reloading configEvent)
    • addConfigurable

      public boolean addConfigurable(ExtendedConfig<?,?> e)
    • addToConfigDictionary

      public void addToConfigDictionary(ExtendedConfig<?,?> e)
    • 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 call ConfigurableTypeAction.onRegisterForge(ExtendedConfig) during the NewRegistryEvent event.
    • loadForgeRegistriesFilled

      public void loadForgeRegistriesFilled()
      Iterate over the given ExtendedConfigs and call ConfigurableTypeAction.onRegisterForgeFilled(ExtendedConfig) during the RegisterEvent event.
    • loadSetup

      public void loadSetup()
      Iterate over the given ExtendedConfigs and call ConfigurableTypeAction.onRegisterSetup(ExtendedConfig) during the FMLCommonSetupEvent.
    • addCategory

      public void addCategory(String category)
      Add a config category.
      Parameters:
      category - The category to add.
    • syncProcessedConfigs

      public void syncProcessedConfigs(net.neoforged.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

      public Map<String,ExtendedConfig<?,?>> getDictionary()
      Get the map of config nameid to config.
      Returns:
      The dictionary.
    • registerToRegistry

      public <V> void registerToRegistry(net.minecraft.core.Registry<? 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.neoforged.neoforge.registries.RegisterEvent event)