Interface ConfigManager
- All Known Implementing Classes:
DefaultConfigManager
public interface ConfigManager
The authoritative controller for a mod's configuration state.
Manages disk I/O, hierarchical registry, and lifecycle synchronization across scopes.
-
Method Summary
Modifier and TypeMethodDescriptionvoidattachServerConfig(net.minecraft.server.MinecraftServer server) Allocates dynamic disk paths and executes parsing for the LEVEL scope tied to the active world instance.<S> ScreateScreen(S parent) Triggers dynamic GUI generation for the active configuration hierarchy.Resolves an existing category or constructs a new structural boundary.Property<?> findProperty(ConfigDescription description) Traverses the active structural hierarchy to resolve a property matching exact logical coordinates.Retrieves all structurally active categories.Retrieves the target disk directory assigned during initialization.getGroupsIn(Category category) Retrieves all structural groups bound to the specific category.Property<?> getOrCreateDynamicProperty(ConfigDescription description, DynamicPropertyTypeRegistry.TypeDefinition<?> typeDefinition, Object defaultValue, Object min, Object max) Allocates a dynamic property instance at runtime, matching specific coordinate definitions.getPropertiesIn(Group group) Retrieves all properties actively bound to the specified group.voidAllocates primary disk paths and executes initial parsing for CLIENT and GLOBAL scopes.voidload()Executes a synchronous disk read across all configuration scopes.voidloadScope(ConfigScope targetScope) Forces a synchronous disk read operation for all properties bound to the specified scope.voidvoidorg.slf4j.Loggerlogger()Retrieves the delegated logging framework instance.voidvoidmodId()Retrieves the bound namespace identifier.registerGroup(Category category, String id) Resolves an existing group or constructs a new structural entity within the specified category.<T> voidregisterProperty(Property<T> config) Injects a property into the active configuration memory state and synchronizes it with disk definitions.voidExecutes hierarchical teardown and unbinds a target category and all dependencies.voidExecutes hierarchical teardown and unbinds a target group and all dependencies.voidDetaches a specific property from the active memory state.voidsave()Executes a synchronous disk write across all configuration scopes.saveAll()Dispatches an asynchronous disk write operation across all configuration scopes.voidsaveScope(ConfigScope targetScope) Forces a synchronous disk write operation for all properties bound to the specified scope.voidsetScreenFactory(Function<Object, Object> factory) Injects a custom screen factory to override default interface rendering protocols.
-
Method Details
-
modId
-
logger
org.slf4j.Logger logger()Retrieves the delegated logging framework instance.- Returns:
- The SLF4J logger.
-
init
Allocates primary disk paths and executes initial parsing for CLIENT and GLOBAL scopes.- Parameters:
configDirectory- The root configuration path provided by the platform environment.
-
attachServerConfig
void attachServerConfig(net.minecraft.server.MinecraftServer server) Allocates dynamic disk paths and executes parsing for the LEVEL scope tied to the active world instance.- Parameters:
server- The active Minecraft server instance.
-
loadScope
Forces a synchronous disk read operation for all properties bound to the specified scope.- Parameters:
targetScope- The target synchronization scope.
-
saveScope
Forces a synchronous disk write operation for all properties bound to the specified scope.- Parameters:
targetScope- The target synchronization scope.
-
load
void load()Executes a synchronous disk read across all configuration scopes. -
save
void save()Executes a synchronous disk write across all configuration scopes. -
saveAll
CompletableFuture<Void> saveAll()Dispatches an asynchronous disk write operation across all configuration scopes.- Returns:
- A CompletableFuture representing the state of the I/O execution.
-
logInfo
-
logWarn
-
logError
-
logDebug
-
define
-
registerGroup
-
registerProperty
Injects a property into the active configuration memory state and synchronizes it with disk definitions.- Parameters:
config- The structural property definition.
-
getOrCreateDynamicProperty
Property<?> getOrCreateDynamicProperty(ConfigDescription description, DynamicPropertyTypeRegistry.TypeDefinition<?> typeDefinition, Object defaultValue, Object min, Object max) Allocates a dynamic property instance at runtime, matching specific coordinate definitions. Utilized primarily for datapack injection or authoritative server synchronization.- Parameters:
description- The absolute coordinate map.typeDefinition- The underlying data class.defaultValue- The baseline state value.min- The lower validation boundary.max- The upper validation boundary.- Returns:
- The dynamically constructed Property instance.
-
remove
Executes hierarchical teardown and unbinds a target category and all dependencies. -
remove
Executes hierarchical teardown and unbinds a target group and all dependencies. -
remove
Detaches a specific property from the active memory state. -
getCategories
-
getGroupsIn
-
getPropertiesIn
-
getConfigDirectory
-
findProperty
Traverses the active structural hierarchy to resolve a property matching exact logical coordinates.- Parameters:
description- The exact definition map.- Returns:
- The resolved Property instance, or null if unbound.
-
setScreenFactory
-
createScreen
<S> S createScreen(S parent) Triggers dynamic GUI generation for the active configuration hierarchy.- Parameters:
parent- The preceding menu screen entity.- Returns:
- The constructed configuration screen entity.
-