Interface Property<T>
- Type Parameters:
T- The foundational data type managed by this property.
- All Known Implementing Classes:
DefaultProperty, DefaultProperty.ARGBColor, DefaultProperty.Block, DefaultProperty.Blocks, DefaultProperty.Boolean, DefaultProperty.Bounded, DefaultProperty.Double, DefaultProperty.Enum, DefaultProperty.Float, DefaultProperty.Integer, DefaultProperty.Item, DefaultProperty.Items, DefaultProperty.List, DefaultProperty.Long, DefaultProperty.RGBColor, DefaultProperty.String
public interface Property<T>
Represents a discrete, manageable configuration value within the structural hierarchy.
Handles state encapsulation, disk serialization, network synchronization, and lifecycle broadcasting.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceDefines callback hooks for internal state transitions. -
Method Summary
Modifier and TypeMethodDescriptionvoidacceptAuthoritativeUpdate(net.minecraft.nbt.Tag tag) Forces a localized state override originating from an authoritative server command or operator edit.voidaddListener(Property.Listener listener) Binds an external listener sequence to the property's lifecycle broadcast collection.com.mojang.serialization.Codec<T> codec()Retrieves the serialization protocol required to translate the property state to and from external formats.comment()Retrieves the supplementary text sequence injected during disk serialization.voiddecodeValueFromNbt(net.minecraft.nbt.Tag tag) Mutates the runtime state by parsing an incoming network transmission payload.Retrieves the baseline state assigned during instantiation prior to modifications or disk loads.Retrieves the extended localization key utilized for client-side GUI tooltip translation.net.minecraft.nbt.TagTranslates the active runtime value into a network-transmittable NBT payload.get()Retrieves the active runtime state.Constructs the absolute coordinate string combining the parent category, group, and resource name.booleanDetermines if the property was constructed dynamically at runtime rather than via static allocation.voidload(com.electronwill.nightconfig.core.UnmodifiableCommentedConfig config) Extracts and applies the corresponding disk definition to the internal state variables.voidExecutes local state teardown.voidApplies an incoming network state sequence to the runtime value and sets the synchronization flag.Retrieves the structural group encapsulating this property.voidremoveListener(Property.Listener listener) Detaches an active listener sequence from the property's broadcast collection.Retrieves the exact registry identifier of the property.voidsave(com.electronwill.nightconfig.core.CommentedConfig config) Injects the localized disk state and documentation string into the designated file format sequence.scope()Retrieves the operational boundary and synchronization policy governing the property.voidMutates the active runtime and disk states, automatically broadcasting the transition to registered listeners.Retrieves the base localization key utilized for client-side GUI title translation.
-
Method Details
-
resourceName
String resourceName()Retrieves the exact registry identifier of the property.- Returns:
- The resource string.
-
parentGroup
Group parentGroup()Retrieves the structural group encapsulating this property.- Returns:
- The bound Group instance.
-
defaultValue
T defaultValue()Retrieves the baseline state assigned during instantiation prior to modifications or disk loads.- Returns:
- The initial default value.
-
codec
com.mojang.serialization.Codec<T> codec()Retrieves the serialization protocol required to translate the property state to and from external formats.- Returns:
- The bound Codec instance.
-
scope
ConfigScope scope()Retrieves the operational boundary and synchronization policy governing the property.- Returns:
- The designated ConfigScope.
-
comment
String comment()Retrieves the supplementary text sequence injected during disk serialization.- Returns:
- The documentation string, or null if unassigned.
-
isDynamic
boolean isDynamic()Determines if the property was constructed dynamically at runtime rather than via static allocation.- Returns:
- True if the property was dynamically injected.
-
translationKey
String translationKey()Retrieves the base localization key utilized for client-side GUI title translation.- Returns:
- The formatted translation key.
-
descriptionTranslationKey
String descriptionTranslationKey()Retrieves the extended localization key utilized for client-side GUI tooltip translation.- Returns:
- The formatted tooltip key.
-
getUniqueId
String getUniqueId()Constructs the absolute coordinate string combining the parent category, group, and resource name.- Returns:
- The hierarchical ID string.
-
get
-
set
Mutates the active runtime and disk states, automatically broadcasting the transition to registered listeners.- Parameters:
newValue- The requested state mutation.
-
acceptAuthoritativeUpdate
void acceptAuthoritativeUpdate(net.minecraft.nbt.Tag tag) Forces a localized state override originating from an authoritative server command or operator edit.- Parameters:
tag- The serialized NBT payload representing the authoritative state.
-
onSync
Applies an incoming network state sequence to the runtime value and sets the synchronization flag.- Parameters:
serverValue- The deserialized value transmitted by the authoritative server.
-
onDisconnect
void onDisconnect()Executes local state teardown. Purges network-assigned runtime values, drops listeners, and detaches dynamic instances. -
encodeValueToNbt
net.minecraft.nbt.Tag encodeValueToNbt()Translates the active runtime value into a network-transmittable NBT payload.- Returns:
- The serialized Tag sequence.
-
decodeValueFromNbt
void decodeValueFromNbt(net.minecraft.nbt.Tag tag) Mutates the runtime state by parsing an incoming network transmission payload.- Parameters:
tag- The serialized NBT state data.
-
load
void load(com.electronwill.nightconfig.core.UnmodifiableCommentedConfig config) Extracts and applies the corresponding disk definition to the internal state variables.- Parameters:
config- The structural disk model holding the property value.
-
save
void save(com.electronwill.nightconfig.core.CommentedConfig config) Injects the localized disk state and documentation string into the designated file format sequence.- Parameters:
config- The target structural disk model.
-
addListener
Binds an external listener sequence to the property's lifecycle broadcast collection.- Parameters:
listener- The callback implementation.
-
removeListener
Detaches an active listener sequence from the property's broadcast collection.- Parameters:
listener- The callback implementation to purge.
-