Package net.neoforged.neoforge.common
Class ModConfigSpec
java.lang.Object
net.neoforged.neoforge.common.ModConfigSpec
- All Implemented Interfaces:
net.neoforged.fml.config.IConfigSpec
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classprivate static classstatic classstatic classstatic classModConfigSpec.EnumValue<T extends Enum<T>>static classstatic classstatic classstatic classModConfigSpec.Range<V extends Comparable<? super V>>static enumUsed to prevent cached config values from being updated unless the game or the world is restarted.static classNested classes/interfaces inherited from interface net.neoforged.fml.config.IConfigSpec
net.neoforged.fml.config.IConfigSpec.ILoadedConfig -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Joinerprivate static final SplitterStores the comments for intermediate levels.Stores the translation keys for intermediate levels.private static final Joinerprivate @Nullable net.neoforged.fml.config.IConfigSpec.ILoadedConfigThe currently loaded config values.private static final org.apache.logging.log4j.Loggerprivate final com.electronwill.nightconfig.core.UnmodifiableConfigStores theModConfigSpec.ValueSpecs, (ab)using the hierarchical structure ofConfig.private final com.electronwill.nightconfig.core.UnmodifiableConfigStores theModConfigSpec.ConfigValues, (ab)using the hierarchical structure ofConfig. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidacceptConfig(@Nullable net.neoforged.fml.config.IConfigSpec.ILoadedConfig config) voidvoidcorrect(com.electronwill.nightconfig.core.CommentedConfig config) intcorrect(com.electronwill.nightconfig.core.CommentedConfig config, com.electronwill.nightconfig.core.ConfigSpec.CorrectionListener listener) intcorrect(com.electronwill.nightconfig.core.CommentedConfig config, com.electronwill.nightconfig.core.ConfigSpec.CorrectionListener listener, @Nullable com.electronwill.nightconfig.core.ConfigSpec.CorrectionListener commentListener) private intcorrect(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 com.electronwill.nightconfig.core.ConfigSpec.CorrectionListener commentListener, boolean dryRun) configwill be downcast toCommentedConfigifdryRunisfalseand a modification needs to be made.private voidforEachValue(Iterable<Object> configValues, Consumer<ModConfigSpec.ConfigValue<?>> consumer) getLevelComment(List<String> path) getLevelTranslationKey(List<String> path) com.electronwill.nightconfig.core.UnmodifiableConfiggetSpec()com.electronwill.nightconfig.core.UnmodifiableConfigbooleanisCorrect(com.electronwill.nightconfig.core.UnmodifiableCommentedConfig config) booleanisEmpty()booleanisLoaded()voidresetCaches(ModConfigSpec.RestartType restartType) voidsave()Saves the current config values to the config file, and fires the config reloading event.private booleanstringsMatchNormalizingNewLines(@Nullable String string1, @Nullable String string2) voidvalidateSpec(net.neoforged.fml.config.ModConfig config)
-
Field Details
-
levelComments
Stores the comments for intermediate levels. -
levelTranslationKeys
Stores the translation keys for intermediate levels. -
spec
private final com.electronwill.nightconfig.core.UnmodifiableConfig specStores theModConfigSpec.ValueSpecs, (ab)using the hierarchical structure ofConfig. -
values
private final com.electronwill.nightconfig.core.UnmodifiableConfig valuesStores theModConfigSpec.ConfigValues, (ab)using the hierarchical structure ofConfig. -
loadedConfig
@Nullable private @Nullable net.neoforged.fml.config.IConfigSpec.ILoadedConfig loadedConfigThe currently loaded config values. -
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER -
LINE_JOINER
-
DOT_JOINER
-
DOT_SPLITTER
-
-
Constructor Details
-
ModConfigSpec
-
-
Method Details
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfacenet.neoforged.fml.config.IConfigSpec
-
getLevelComment
-
getLevelTranslationKey
-
acceptConfig
public void acceptConfig(@Nullable @Nullable net.neoforged.fml.config.IConfigSpec.ILoadedConfig config) - Specified by:
acceptConfigin interfacenet.neoforged.fml.config.IConfigSpec
-
validateSpec
public void validateSpec(net.neoforged.fml.config.ModConfig config) - Specified by:
validateSpecin interfacenet.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
-
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:
isCorrectin interfacenet.neoforged.fml.config.IConfigSpec
-
correct
public void correct(com.electronwill.nightconfig.core.CommentedConfig config) - Specified by:
correctin interfacenet.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) configwill be downcast toCommentedConfigifdryRunisfalseand a modification needs to be made. -
stringsMatchNormalizingNewLines
-
split
-