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 ModContainerprivate final String(package private) @Nullable LoadedConfig(package private) final LockNightConfig's own configs are threadsafe, but mod code is not necessarily.private final IConfigSpecprivate final ModConfig.Type -
Constructor Summary
ConstructorsConstructorDescriptionModConfig(ModConfig.Type type, IConfigSpec spec, ModContainer container, String fileName, ReentrantLock lock) -
Method Summary
Modifier and TypeMethodDescription@Nullable PathGet the file path of the currently loaded config.Retrieve the currently loaded config, for direct manipulation of the underlyingCommentedConfig.getModId()getSpec()getType()(package private) voidsetConfig(@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 benullwhen the config is not loaded. -
getFullPath
Get the file path of the currently loaded config.- Returns:
- The config's path. Will return
nullif 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)
-