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 Details

    • modId

      String modId()
      Retrieves the bound namespace identifier.
      Returns:
      The registered mod ID.
    • logger

      org.slf4j.Logger logger()
      Retrieves the delegated logging framework instance.
      Returns:
      The SLF4J logger.
    • init

      void init(Path configDirectory)
      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

      void loadScope(ConfigScope targetScope)
      Forces a synchronous disk read operation for all properties bound to the specified scope.
      Parameters:
      targetScope - The target synchronization scope.
    • saveScope

      void saveScope(ConfigScope targetScope)
      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

      Dispatches an asynchronous disk write operation across all configuration scopes.
      Returns:
      A CompletableFuture representing the state of the I/O execution.
    • logInfo

      void logInfo(String message, Object... params)
    • logWarn

      void logWarn(String message, Object... params)
    • logError

      void logError(String message, Object... params)
    • logDebug

      void logDebug(String message, Object... params)
    • define

      Category define(String id)
      Resolves an existing category or constructs a new structural boundary.
      Parameters:
      id - The category identifier.
      Returns:
      The bound Category instance.
    • registerGroup

      Group registerGroup(Category category, String id)
      Resolves an existing group or constructs a new structural entity within the specified category.
      Parameters:
      category - The parent structural boundary.
      id - The group identifier.
      Returns:
      The bound Group instance.
    • registerProperty

      <T> void registerProperty(Property<T> config)
      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

      void remove(Category category)
      Executes hierarchical teardown and unbinds a target category and all dependencies.
    • remove

      void remove(Group group)
      Executes hierarchical teardown and unbinds a target group and all dependencies.
    • remove

      void remove(Property<?> property)
      Detaches a specific property from the active memory state.
    • getCategories

      List<Category> getCategories()
      Retrieves all structurally active categories.
    • getGroupsIn

      List<Group> getGroupsIn(Category category)
      Retrieves all structural groups bound to the specific category.
    • getPropertiesIn

      List<Property<?>> getPropertiesIn(Group group)
      Retrieves all properties actively bound to the specified group.
    • getConfigDirectory

      Optional<Path> getConfigDirectory()
      Retrieves the target disk directory assigned during initialization.
    • findProperty

      Property<?> findProperty(ConfigDescription description)
      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

      void setScreenFactory(Function<Object,Object> factory)
      Injects a custom screen factory to override default interface rendering protocols. Execute binding prior to platform-specific GUI endpoint registration.
      Parameters:
      factory - The functional screen construction sequence.
    • 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.