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 class
static class
private static class
static class
static class
static class
ModConfigSpec.EnumValue<T extends Enum<T>>
static class
static class
static class
static class
ModConfigSpec.Range<V extends Comparable<? super V>>
static enum
Used to prevent cached config values from being updated unless the game or the world is restarted.static class
Nested classes/interfaces inherited from interface net.neoforged.fml.config.IConfigSpec
net.neoforged.fml.config.IConfigSpec.ILoadedConfig
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final com.google.common.base.Joiner
private static final com.google.common.base.Splitter
Stores the comments for intermediate levels.Stores the translation keys for intermediate levels.private static final com.google.common.base.Joiner
private @Nullable net.neoforged.fml.config.IConfigSpec.ILoadedConfig
The currently loaded config values.private static final org.apache.logging.log4j.Logger
private final com.electronwill.nightconfig.core.UnmodifiableConfig
Stores theModConfigSpec.ValueSpec
s, (ab)using the hierarchical structure ofConfig
.private final com.electronwill.nightconfig.core.UnmodifiableConfig
Stores theModConfigSpec.ConfigValue
s, (ab)using the hierarchical structure ofConfig
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptConfig
(@Nullable net.neoforged.fml.config.IConfigSpec.ILoadedConfig config) void
void
correct
(com.electronwill.nightconfig.core.CommentedConfig config) int
correct
(com.electronwill.nightconfig.core.CommentedConfig config, com.electronwill.nightconfig.core.ConfigSpec.CorrectionListener listener) int
correct
(com.electronwill.nightconfig.core.CommentedConfig config, com.electronwill.nightconfig.core.ConfigSpec.CorrectionListener listener, @Nullable com.electronwill.nightconfig.core.ConfigSpec.CorrectionListener commentListener) 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 com.electronwill.nightconfig.core.ConfigSpec.CorrectionListener commentListener, boolean dryRun) config
will be downcast toCommentedConfig
ifdryRun
isfalse
and a modification needs to be made.private void
forEachValue
(Iterable<Object> configValues, Consumer<ModConfigSpec.ConfigValue<?>> consumer) getLevelComment
(List<String> path) getLevelTranslationKey
(List<String> path) com.electronwill.nightconfig.core.UnmodifiableConfig
getSpec()
com.electronwill.nightconfig.core.UnmodifiableConfig
boolean
isCorrect
(com.electronwill.nightconfig.core.UnmodifiableCommentedConfig config) boolean
isEmpty()
boolean
isLoaded()
void
resetCaches
(ModConfigSpec.RestartType restartType) void
save()
Saves the current config values to the config file, and fires the config reloading event.private boolean
stringsMatchNormalizingNewLines
(@Nullable String string1, @Nullable String string2) void
validateSpec
(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.ValueSpec
s, (ab)using the hierarchical structure ofConfig
. -
values
private final com.electronwill.nightconfig.core.UnmodifiableConfig valuesStores theModConfigSpec.ConfigValue
s, (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
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
-
-
Method Details
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfacenet.neoforged.fml.config.IConfigSpec
-
getLevelComment
-
getLevelTranslationKey
-
acceptConfig
public void acceptConfig(@Nullable @Nullable net.neoforged.fml.config.IConfigSpec.ILoadedConfig config) - Specified by:
acceptConfig
in interfacenet.neoforged.fml.config.IConfigSpec
-
validateSpec
public void validateSpec(net.neoforged.fml.config.ModConfig config) - Specified by:
validateSpec
in 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:
isCorrect
in interfacenet.neoforged.fml.config.IConfigSpec
-
correct
public void correct(com.electronwill.nightconfig.core.CommentedConfig config) - Specified by:
correct
in 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) config
will be downcast toCommentedConfig
ifdryRun
isfalse
and a modification needs to be made. -
stringsMatchNormalizingNewLines
-
split
-