Class ModConfigSpec

java.lang.Object
net.neoforged.neoforge.common.ModConfigSpec
All Implemented Interfaces:
net.neoforged.fml.config.IConfigSpec

public class ModConfigSpec extends Object implements net.neoforged.fml.config.IConfigSpec
  • Field Details

    • levelComments

      private final Map<List<String>,String> levelComments
      Stores the comments for intermediate levels.
    • levelTranslationKeys

      private final Map<List<String>,String> levelTranslationKeys
      Stores the translation keys for intermediate levels.
    • spec

      private final com.electronwill.nightconfig.core.UnmodifiableConfig spec
      Stores the ModConfigSpec.ValueSpecs, (ab)using the hierarchical structure of Config.
    • values

      private final com.electronwill.nightconfig.core.UnmodifiableConfig values
      Stores the ModConfigSpec.ConfigValues, (ab)using the hierarchical structure of Config.
    • loadedConfig

      @Nullable private @Nullable net.neoforged.fml.config.IConfigSpec.ILoadedConfig loadedConfig
      The currently loaded config values.
    • LOGGER

      private static final org.apache.logging.log4j.Logger LOGGER
    • LINE_JOINER

      private static final com.google.common.base.Joiner LINE_JOINER
    • DOT_JOINER

      private static final com.google.common.base.Joiner DOT_JOINER
    • DOT_SPLITTER

      private static final com.google.common.base.Splitter DOT_SPLITTER
  • Constructor Details

    • ModConfigSpec

      private ModConfigSpec(com.electronwill.nightconfig.core.UnmodifiableConfig spec, com.electronwill.nightconfig.core.UnmodifiableConfig values, Map<List<String>,String> levelComments, Map<List<String>,String> levelTranslationKeys)
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface net.neoforged.fml.config.IConfigSpec
    • getLevelComment

      public String getLevelComment(List<String> path)
    • getLevelTranslationKey

      public String getLevelTranslationKey(List<String> path)
    • acceptConfig

      public void acceptConfig(@Nullable @Nullable net.neoforged.fml.config.IConfigSpec.ILoadedConfig config)
      Specified by:
      acceptConfig in interface net.neoforged.fml.config.IConfigSpec
    • validateSpec

      public void validateSpec(net.neoforged.fml.config.ModConfig config)
      Specified by:
      validateSpec in interface net.neoforged.fml.config.IConfigSpec
    • isLoaded

      public boolean isLoaded()
    • getSpec

      public com.electronwill.nightconfig.core.UnmodifiableConfig getSpec()
    • getValues

      public com.electronwill.nightconfig.core.UnmodifiableConfig getValues()
    • forEachValue

      private void forEachValue(Iterable<Object> configValues, Consumer<ModConfigSpec.ConfigValue<?>> consumer)
    • afterReload

      public void afterReload()
    • resetCaches

      @Internal public void resetCaches(ModConfigSpec.RestartType restartType)
    • save

      public void save()
      Saves the current config values to the config file, and fires the config reloading event.
    • isCorrect

      public boolean isCorrect(com.electronwill.nightconfig.core.UnmodifiableCommentedConfig config)
      Specified by:
      isCorrect in interface net.neoforged.fml.config.IConfigSpec
    • correct

      public void correct(com.electronwill.nightconfig.core.CommentedConfig config)
      Specified by:
      correct in interface net.neoforged.fml.config.IConfigSpec
    • correct

      public int correct(com.electronwill.nightconfig.core.CommentedConfig config, com.electronwill.nightconfig.core.ConfigSpec.CorrectionListener listener)
    • correct

      public int correct(com.electronwill.nightconfig.core.CommentedConfig config, com.electronwill.nightconfig.core.ConfigSpec.CorrectionListener listener, @Nullable @Nullable com.electronwill.nightconfig.core.ConfigSpec.CorrectionListener commentListener)
    • correct

      private int correct(com.electronwill.nightconfig.core.UnmodifiableConfig spec, com.electronwill.nightconfig.core.UnmodifiableCommentedConfig config, LinkedList<String> parentPath, List<String> parentPathUnmodifiable, com.electronwill.nightconfig.core.ConfigSpec.CorrectionListener listener, @Nullable @Nullable com.electronwill.nightconfig.core.ConfigSpec.CorrectionListener commentListener, boolean dryRun)
      config will be downcast to CommentedConfig if dryRun is false and a modification needs to be made.
    • stringsMatchNormalizingNewLines

      private boolean stringsMatchNormalizingNewLines(@Nullable @Nullable String string1, @Nullable @Nullable String string2)
    • split

      private static List<String> split(String path)