Class ExtendedConfig<C extends ExtendedConfig<C,I>,I>

java.lang.Object
org.cyclops.cyclopscore.config.extendedconfig.ExtendedConfig<C,I>
Type Parameters:
C - Class of the extension of ExtendedConfig
I - The instance corresponding to this config.
All Implemented Interfaces:
Comparable<ExtendedConfig<C,I>>
Direct Known Subclasses:
CapabilityConfig, CreativeModeTabConfig, DummyConfig, ExtendedConfigForge, FluidConfig, RecipeConditionConfig, TrunkPlacerConfig, WorldStructureConfig

public abstract class ExtendedConfig<C extends ExtendedConfig<C,I>,I> extends Object implements Comparable<ExtendedConfig<C,I>>
A config that refers to a configurable. Every unique configurable must have one unique extension of this class. This extension can contain several configurable settings and properties that can also be set in the config file.
  • Field Details

  • Constructor Details

    • ExtendedConfig

      public ExtendedConfig(ModBase mod, String namedId, Function<C,? extends I> elementConstructor)
      Create a new config
      Parameters:
      mod - The mod instance.
      namedId - A unique name id
      elementConstructor - The element constructor.
  • Method Details

    • getConfigPropertyPrefix

      protected String getConfigPropertyPrefix(ConfigurableProperty annotation)
      Parameters:
      annotation - The annotation to define the prefix for.
      Returns:
      The prefix that will be used inside the config file for ConfigurableProperty's.
    • initializeInstance

      protected void initializeInstance()
    • save

      protected void save()
      Save this config inside the correct element and inside the implementation if itself.
    • getConfigurableType

      public abstract ConfigurableType getConfigurableType()
      Return the configurable type for which this config holds data
      Returns:
      the type of the configurable to where the config belongs
    • getTranslationKey

      public abstract String getTranslationKey()
      Get the unlocalized name (must be unique!) for this configurable.
      Returns:
      The unlocalized name.
    • getFullTranslationKey

      public String getFullTranslationKey()
      Get the full unlocalized name for this configurable.
      Returns:
      The unlocalized name.
    • getInstance

      public I getInstance()
      Returns:
      Instance of the object this config refers to.
    • getSubUniqueName

      public String getSubUniqueName()
      Will return the unique name of the object this config refers to
      Returns:
      unique name of sub object
    • onRegistered

      public void onRegistered()
      Overridable method that is called after the element of this config is fully registered, after the FMLCommonSetupEvent.
    • onForgeRegistered

      public void onForgeRegistered()
      Overridable method that is immediately called after this element has been registered into a Forge registry.
    • compareTo

      public int compareTo(ExtendedConfig<C,I> o)
      Specified by:
      compareTo in interface Comparable<C extends ExtendedConfig<C,I>>
    • showDoubleInitError

      public void showDoubleInitError()
      Call this method in the initInstance method of Configurables if the instance was already set.
    • downCast

      @Deprecated public C downCast()
      Deprecated.
      Get the lowest castable config.
      Returns:
      The downcasted config.
    • onConfigPropertyReload

      public void onConfigPropertyReload(ConfigurablePropertyData<?> configProperty, boolean reload)
      Called when the config is loaded or reloaded
      Parameters:
      reload - If we are reloading, otherwise this is an initial load.
      configProperty - The config property