Package net.neoforged.fml.config
Class ModConfig
java.lang.Object
net.neoforged.fml.config.ModConfig
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final ModContainer
private final String
(package private) @Nullable LoadedConfig
(package private) final Lock
NightConfig's own configs are threadsafe, but mod code is not necessarily.private final IConfigSpec
private final ModConfig.Type
-
Constructor Summary
ConstructorsConstructorDescriptionModConfig
(ModConfig.Type type, IConfigSpec spec, ModContainer container, String fileName, ReentrantLock lock) -
Method Summary
Modifier and TypeMethodDescription@Nullable Path
Get the file path of the currently loaded config.Retrieve the currently loaded config, for direct manipulation of the underlyingCommentedConfig
.getModId()
getSpec()
getType()
(package private) void
setConfig
(@Nullable LoadedConfig loadedConfig, Function<ModConfig, ModConfigEvent> eventConstructor)
-
Field Details
-
type
-
spec
-
fileName
-
container
-
loadedConfig
-
lock
NightConfig's own configs are threadsafe, but mod code is not necessarily. This lock is used to prevent multiple concurrent config reloads or event dispatches.
-
-
Constructor Details
-
ModConfig
ModConfig(ModConfig.Type type, IConfigSpec spec, ModContainer container, String fileName, ReentrantLock lock)
-
-
Method Details
-
getType
-
getFileName
-
getSpec
-
getModId
-
getLoadedConfig
Retrieve the currently loaded config, for direct manipulation of the underlyingCommentedConfig
. Note that the config will change on reloads, and will benull
when the config is not loaded. -
getFullPath
Get the file path of the currently loaded config.- Returns:
- The config's path. Will return
null
if the config is not currently loaded, or was loaded from memory rather than from a file.
-
setConfig
void setConfig(@Nullable @Nullable LoadedConfig loadedConfig, Function<ModConfig, ModConfigEvent> eventConstructor)
-