Skip to content

net.kernelpanicsoft.archie.config.builder

Types

ColorListBuilder

class ColorListBuilder(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: List<Color>, 
    factory: () -> Color
) : ListFieldBuilder<Int, ColorEntry, ColorListBuilder> 

ListFieldBuilder for Color values, using Cloth Config's startColorField per row. Set alphaMode to allow editing alpha.

ColorMapBuilder

class ColorMapBuilder(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: Map<String, Color>, 
    factory: () -> Color
) : MapFieldBuilder<Int, ColorEntry, ColorMapBuilder> 

MapFieldBuilder for Color values, using Cloth Config's startColorField per row. Set alphaMode to allow editing alpha.

ConfigFieldBuilder

class ConfigFieldBuilder<T : Any>(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: T, 
    openScreen: (Screen) -> Screen
) : AbstractFieldBuilder<T, ConfigSpecEntry<T>, ConfigFieldBuilder<T>> 

Cloth Config field builder producing a ConfigSpecEntry - a single "Edit" button field that navigates into whatever screen openScreen builds for value. Built via ConfigEntryBuilder.startConfigField/startScreenField, used by net.kernelpanicsoft.archie.config.ClientConfigContainer and net.kernelpanicsoft.archie.config.ClientConfigGroup to let a container/group screen drill down into each of its children.

ConfigRefFieldBuilder

class ConfigRefFieldBuilder<T : ConfigSpec>(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    options: List<T>, 
    value: T
) : AbstractFieldBuilder<T, ConfigRefEntry<T>, ConfigRefFieldBuilder<T>> 

Cloth Config field builder producing a ConfigRefEntry for a configRef field. Built via ConfigEntryBuilder.startConfigRefField.

ConfigSpecListBuilder

class ConfigSpecListBuilder<T : ConfigSpec>(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: List<T>, 
    scratchFactory: () -> T
) : ListFieldBuilder<T, ConfigSpecEntry<T>, ConfigSpecListBuilder<T>> 

ListFieldBuilder for a net.kernelpanicsoft.archie.config.ConfigSpecList - each row is an "Edit" button (ConfigSpecEntry) via startConfigField; a new row comes from scratchFactory (auto-named, wired to the collection's own directory).

ConfigSpecMapBuilder

class ConfigSpecMapBuilder<T : ConfigSpec>(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: Map<String, T>, 
    scratchFactory: () -> T
) : MapFieldBuilder<T, ConfigSpecEntry<T>, ConfigSpecMapBuilder<T>> 

MapFieldBuilder for a net.kernelpanicsoft.archie.config.ConfigSpecMap - each row's value column is an "Edit" button (ConfigSpecEntry) via startConfigField. A ConfigSpec's id is fixed at creation, so the row's key text only names a brand-new entry (see net.kernelpanicsoft.archie.config.ConfigSpecCollection.reconcile) - retyping an existing row's key doesn't rename its file.

DoubleMapBuilder

class DoubleMapBuilder(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: Map<String, Double>
) : MapFieldBuilder<Double, DoubleListEntry, DoubleMapBuilder> 

MapFieldBuilder for Double values, using Cloth Config's startDoubleField per row.

open class DropdownFieldBuilder<T : Any>(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: T, 
    var selections: Iterable<T> = emptyList()
) : AbstractFieldBuilder<T, DropdownBoxEntry<T>, DropdownFieldBuilder<T>> 

Cloth Config builder for a dropdown/autocomplete field over selections. Set toObjectFunction to parse free-typed text back into a T (required when suggestionMode is enabled); override toTextFunction to customize how values are displayed.

FloatMapBuilder

class FloatMapBuilder(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: Map<String, Float>
) : MapFieldBuilder<Float, FloatListEntry, FloatMapBuilder> 

MapFieldBuilder for Float values, using Cloth Config's startFloatField per row.

IntegerMapBuilder

class IntegerMapBuilder(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: Map<String, Int>
) : MapFieldBuilder<Int, IntegerListEntry, IntegerMapBuilder> 

MapFieldBuilder for Int values, using Cloth Config's startIntField per row.

KeycodeListBuilder

class KeycodeListBuilder(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: List<ModifierKeyCode>, 
    factory: () -> ModifierKeyCode
) : ListFieldBuilder<ModifierKeyCode, KeyCodeEntry, KeycodeListBuilder> 

ListFieldBuilder for ModifierKeyCode values, using Cloth Config's startModifierKeyCodeField per row. allowKey and allowMouse can't both be false - at least one input source must remain selectable. allowModifiers toggles whether Ctrl/Shift/Alt can be bound alongside the key.

KeycodeMapBuilder

class KeycodeMapBuilder(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: Map<String, ModifierKeyCode>, 
    factory: () -> ModifierKeyCode
) : MapFieldBuilder<ModifierKeyCode, KeyCodeEntry, KeycodeMapBuilder> 

MapFieldBuilder for ModifierKeyCode values, using Cloth Config's startModifierKeyCodeField per row. See KeycodeListBuilder for the allowKey/allowMouse/allowModifiers constraints.

ListFieldBuilder

abstract class ListFieldBuilder<T, A : AbstractConfigListEntry<T>, SELF : ListFieldBuilder<T, A, SELF>>(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: List<T>
) : AbstractListBuilder<T, NestedListListEntry<T, A>, SELF> 

Base Cloth Config builder for a list field, rendered as an editable list of rows sharing one element type. Concrete subclasses (e.g. KeycodeListBuilder) only need to implement factory (the default for a newly-inserted row) and builder (the field builder for each row); this class handles add/remove wiring and error/tooltip propagation.

LongMapBuilder

class LongMapBuilder(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: Map<String, Long>
) : MapFieldBuilder<Long, LongListEntry, LongMapBuilder> 

MapFieldBuilder for Long values, using Cloth Config's startLongField per row.

MapFieldBuilder

abstract class MapFieldBuilder<T, A : AbstractConfigListEntry<T>, SELF : MapFieldBuilder<T, A, SELF>>(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: Map<String, T>
) : AbstractListBuilder<MutableEntry<String, T>, NestedListListEntry<MutableEntry<String, T>, MultiElementListEntry<MutableEntry<String, T>>>, SELF> 

Base Cloth Config builder for a String-keyed map field, rendered as a nested list of editable key/value rows. Concrete subclasses (e.g. IntegerMapBuilder) only need to implement valueFactory (the default for a newly-inserted row) and valueBuilder (the field builder for the value column); this class handles the key column, duplicate-key validation, and row add/remove wiring.

RegistryFieldBuilder

class RegistryFieldBuilder<T : Any, R : T>(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    subclass: KClass<R>? = null, 
    registry: Registry<T>, 
    value: T
) : DropdownMenuBuilder<T> 

Cloth Config builder for a single registry entry, rendered as a dropdown over every entry (optionally filtered to instances of subclass) sorted by registry name. Recognized entry types (Item, Block, BlockEntityType) get an icon in their dropdown cell; anything else falls back to a plain text cell.

RegistryListBuilder

class RegistryListBuilder<T : Any, R : T>(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: List<T>, 
    factory: () -> T, 
    subclass: KClass<R>? = null, 
    registry: Registry<T>
) : ListFieldBuilder<T, DropdownBoxEntry<T>, RegistryListBuilder<T, R>> 

ListFieldBuilder for registry entries, using RegistryFieldBuilder per row.

RegistryMapBuilder

class RegistryMapBuilder<T : Any, R : T>(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: Map<String, T>, 
    factory: () -> T, 
    subclass: KClass<R>? = null, 
    registry: Registry<T>
) : MapFieldBuilder<T, DropdownBoxEntry<T>, RegistryMapBuilder<T, R>> 

MapFieldBuilder for registry entries, using RegistryFieldBuilder per row.

SpecFieldBuilder

class SpecFieldBuilder<T : DataSpec>(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: T
) : AbstractFieldBuilder<T, MultiElementListEntry<T>, SpecFieldBuilder<T>> 

Cloth Config builder for a nested DataSpec field, rendered as a collapsible group containing value's own fields and subcategories (via DataSpec.client).

SpecListBuilder

class SpecListBuilder<T : DataSpec>(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: List<T>, 
    factory: () -> T
) : ListFieldBuilder<T, MultiElementListEntry<T>, SpecListBuilder<T>> 

ListFieldBuilder for nested DataSpec entries, using SpecFieldBuilder per row.

SpecMapBuilder

class SpecMapBuilder<T : DataSpec>(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: Map<String, T>, 
    valueFactory: () -> T
) : MapFieldBuilder<T, MultiElementListEntry<T>, SpecMapBuilder<T>> 

MapFieldBuilder for nested DataSpec entries, using SpecFieldBuilder per row.

StringMapBuilder

class StringMapBuilder(
    resetButtonKey: Component, 
    fieldNameKey: Component, 
    value: Map<String, String>
) : MapFieldBuilder<String, StringListEntry, StringMapBuilder> 

MapFieldBuilder for String values, using Cloth Config's startStrField per row.

Properties

alphaMode

var ColorFieldBuilder.alphaMode: Boolean

Reflectively exposes Cloth Config's private alpha flag on ColorFieldBuilder, since it has no public getter/setter.

Functions

ofBlockEntityTypeObject

fun ofBlockEntityTypeObject(): DropdownBoxEntry.SelectionCellCreator<BlockEntityType<*>>

A DropdownBoxEntry cell creator that renders each BlockEntityType option as its owning block's item icon plus registry name, for use with a dropdown field over block entity types.

startColorList

fun ConfigEntryBuilder.startColorList(
    fieldNameKey: Component, 
    value: List<Color>, 
    factory: () -> Color
): ColorListBuilder

See startSpecField. Builds a list of color entries; factory supplies a value for newly-inserted rows.

startColorMap

fun ConfigEntryBuilder.startColorMap(
    fieldNameKey: Component, 
    value: Map<String, Color>, 
    factory: () -> Color
): ColorMapBuilder

See startSpecField. Builds a String-keyed map of color entries; factory supplies a value for newly-inserted rows.

startConfigField

fun <T : ConfigSpec> ConfigEntryBuilder.startConfigField(fieldNameKey: Component, value: T): ConfigFieldBuilder<T>

startConfigRefField

fun <T : ConfigSpec> ConfigEntryBuilder.startConfigRefField(
    fieldNameKey: Component, 
    options: List<T>, 
    value: T
): ConfigRefFieldBuilder<T>

Builds a cycle-selector-plus-edit-button field for a configRef field. See ConfigRefFieldBuilder.

startConfigSpecList

fun <T : ConfigSpec> ConfigEntryBuilder.startConfigSpecList(
    fieldNameKey: Component, 
    value: List<T>, 
    scratchFactory: () -> T
): ConfigSpecListBuilder<T>

Builds a native add/remove list field for a net.kernelpanicsoft.archie.config.ConfigSpecList. See ConfigSpecListBuilder.

startConfigSpecMap

fun <T : ConfigSpec> ConfigEntryBuilder.startConfigSpecMap(
    fieldNameKey: Component, 
    value: Map<String, T>, 
    scratchFactory: () -> T
): ConfigSpecMapBuilder<T>

Builds a native add/remove map field for a net.kernelpanicsoft.archie.config.ConfigSpecMap. See ConfigSpecMapBuilder.

startDoubleMap

fun ConfigEntryBuilder.startDoubleMap(fieldNameKey: Component, value: Map<String, Double>): DoubleMapBuilder

See startSpecField. Builds a String-keyed map of Double entries.

startDropdownField

fun <T : Any> ConfigEntryBuilder.startDropdownField(
    fieldNameKey: Component, 
    value: T, 
    selections: Iterable<T> = emptyList()
): DropdownFieldBuilder<T>

See startSpecField. Builds a dropdown field over arbitrary selections of any type T.

startFloatMap

fun ConfigEntryBuilder.startFloatMap(fieldNameKey: Component, value: Map<String, Float>): FloatMapBuilder

See startSpecField. Builds a String-keyed map of Float entries.

startIntMap

fun ConfigEntryBuilder.startIntMap(fieldNameKey: Component, value: Map<String, Int>): IntegerMapBuilder

See startSpecField. Builds a String-keyed map of Int entries.

startKeycodeList

fun ConfigEntryBuilder.startKeycodeList(
    fieldNameKey: Component, 
    value: List<ModifierKeyCode>, 
    factory: () -> ModifierKeyCode
): KeycodeListBuilder

See startSpecField. Builds a list of keybind entries; factory supplies a value for newly-inserted rows.

startKeycodeMap

fun ConfigEntryBuilder.startKeycodeMap(
    fieldNameKey: Component, 
    value: Map<String, ModifierKeyCode>, 
    factory: () -> ModifierKeyCode
): KeycodeMapBuilder

See startSpecField. Builds a String-keyed map of keybind entries; factory supplies a value for newly-inserted rows.

startLongMap

fun ConfigEntryBuilder.startLongMap(fieldNameKey: Component, value: Map<String, Long>): LongMapBuilder

See startSpecField. Builds a String-keyed map of Long entries.

startRegistryField

fun <T : Any, R : T> ConfigEntryBuilder.startRegistryField(
    fieldNameKey: Component, 
    value: T, 
    subclass: KClass<R>? = null, 
    registry: Registry<T>
): RegistryFieldBuilder<T, R>

See startSpecField. Builds a single registry-entry field, resolved against registry and optionally narrowed to subclass.

startRegistryList

fun <T : Any, R : T> ConfigEntryBuilder.startRegistryList(
    fieldNameKey: Component, 
    value: List<T>, 
    factory: () -> T, 
    subclass: KClass<R>? = null, 
    registry: Registry<T>
): RegistryListBuilder<T, R>

See startSpecField. Builds a list of registry entries; factory supplies a value for newly-inserted rows.

startRegistryMap

fun <T : Any, R : T> ConfigEntryBuilder.startRegistryMap(
    fieldNameKey: Component, 
    value: Map<String, T>, 
    factory: () -> T, 
    subclass: KClass<R>? = null, 
    registry: Registry<T>
): RegistryMapBuilder<T, R>

See startSpecField. Builds a String-keyed map of registry entries; factory supplies a value for newly-inserted rows.

startScreenField

fun <T : Any> ConfigEntryBuilder.startScreenField(
    fieldNameKey: Component, 
    value: T, 
    openScreen: (Screen) -> Screen
): ConfigFieldBuilder<T>

Like startConfigField, but for any value with an explicit openScreen rather than one specifically backed by ConfigSpec.client.

startSpecField

fun <T : DataSpec> ConfigEntryBuilder.startSpecField(fieldNameKey: Component, value: T): SpecFieldBuilder<T>

The start*Field/start*List/start*Map functions below extend ConfigEntryBuilder the same way Cloth Config's own built-ins do (startBooleanToggle, startIntField, ...), so the field types Archie adds - nested specs, registry entries, keybind/color lists and maps - are used the same way. Each one just forwards to the matching builder class's constructor.

startSpecList

fun <T : DataSpec> ConfigEntryBuilder.startSpecList(
    fieldNameKey: Component, 
    value: List<T>, 
    factory: () -> T
): SpecListBuilder<T>

See startSpecField. Builds a list of nested DataSpec entries.

startSpecMap

fun <T : DataSpec> ConfigEntryBuilder.startSpecMap(
    fieldNameKey: Component, 
    value: Map<String, T>, 
    factory: () -> T
): SpecMapBuilder<T>

See startSpecField. Builds a String-keyed map of nested DataSpec entries.

startStringDropdownField

fun ConfigEntryBuilder.startStringDropdownField(
    fieldNameKey: Component, 
    value: String, 
    selections: Iterable<String> = emptyList()
): DropdownFieldBuilder<String>

See startSpecField. Builds a dropdown field over arbitrary selections, accepting free-text input for a String value.

startStrMap

fun ConfigEntryBuilder.startStrMap(fieldNameKey: Component, value: Map<String, String>): StringMapBuilder

See startSpecField. Builds a String-keyed map of String entries.