Skip to content

ConfigContainer

abstract class ConfigContainer(val mod: Mod, val title: Component = Component.literal(mod.name))

The single per-mod root of the config system, declared as a singleton object holding one or more nested ConfigNodes - ConfigSpecs, ConfigGroups (folders), and ConfigSpecCollections (dynamic, directory-backed collections):

object Config : ConfigContainer(MyMod.MOD) {
    object Common : ConfigSpec.Common(MyMod.MOD) { ... }
    object Client : ConfigSpec.Client(MyMod.MOD) { ... }
}

Call init once during common mod init, on both physical sides; it initializes every nested ConfigNode (loading/creating each ConfigSpec's file per its ConfigSpec.predicate timing, scanning each ConfigSpecCollection's directory) and, on the client, builds and registers the merged Cloth Config UI screen via ClientConfigContainer.

Parameters

  • mod: The owning mod, used to derive each nested ConfigSpec's default filename.

  • title: Display title used for the container's screen when it holds more than one ConfigNode. Defaults to mod's name.

Inheritors

Constructors

ConfigContainer

constructor(mod: Mod, title: Component = Component.literal(mod.name))

Parameters

  • mod: The owning mod, used to derive each nested ConfigSpec's default filename.

  • title: Display title used for the container's screen when it holds more than one ConfigNode. Defaults to mod's name.

Properties

children

Nested ConfigNodes declared inside this container.

mod

val mod: Mod

Parameters

  • mod: The owning mod, used to derive each nested ConfigSpec's default filename.

title

val title: Component

Parameters

  • title: Display title used for the container's screen when it holds more than one ConfigNode. Defaults to mod's name.

Functions

init

fun init()

Initializes every reachable ConfigNode and, on the client, registers the config UI screen.