Class DefaultProperty<T>
java.lang.Object
johnsmith.configoverhauled.impl.core.state.DefaultProperty<T>
- All Implemented Interfaces:
Property<T>
- Direct Known Subclasses:
DefaultProperty.Block, DefaultProperty.Boolean, DefaultProperty.Bounded, DefaultProperty.Enum, DefaultProperty.Item, DefaultProperty.List, DefaultProperty.String
public abstract sealed class DefaultProperty<T>
extends Object
implements Property<T>
permits DefaultProperty.Boolean, DefaultProperty.Bounded<T>, DefaultProperty.Enum<E>, DefaultProperty.List<E>, DefaultProperty.String, DefaultProperty.Block, DefaultProperty.Item
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classstatic final classstatic final classstatic classDefaultProperty.Bounded<T extends Number & Comparable<T>>static final classstatic final classDefaultProperty.Enum<E extends Enum<E>>static final classstatic final classstatic final classstatic final classstatic classstatic final classstatic final classstatic final classNested classes/interfaces inherited from interface Property
Property.Listener -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefaultProperty(String resourceName, Group category, ConfigScope scope, String comment, T defaultValue, com.mojang.serialization.Codec<T> codec, boolean isDynamic) -
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.protected voidappendDefaultValueComment(StringBuilder builder) protected Stringcom.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.booleanget()Retrieves the active runtime state.Constructs the absolute coordinate string combining the parent category, group, and resource name.inthashCode()protected voidbooleanDetermines 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.protected voidvoidExecutes 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.protected T
-
Constructor Details
-
DefaultProperty
-
-
Method Details
-
resourceName
Description copied from interface:PropertyRetrieves the exact registry identifier of the property.- Specified by:
resourceNamein interfaceProperty<T>- Returns:
- The resource string.
-
parentGroup
Description copied from interface:PropertyRetrieves the structural group encapsulating this property.- Specified by:
parentGroupin interfaceProperty<T>- Returns:
- The bound Group instance.
-
defaultValue
Description copied from interface:PropertyRetrieves the baseline state assigned during instantiation prior to modifications or disk loads.- Specified by:
defaultValuein interfaceProperty<T>- Returns:
- The initial default value.
-
codec
-
scope
Description copied from interface:PropertyRetrieves the operational boundary and synchronization policy governing the property. -
comment
-
isDynamic
-
translationKey
Description copied from interface:PropertyRetrieves the base localization key utilized for client-side GUI title translation.- Specified by:
translationKeyin interfaceProperty<T>- Returns:
- The formatted translation key.
-
descriptionTranslationKey
Description copied from interface:PropertyRetrieves the extended localization key utilized for client-side GUI tooltip translation.- Specified by:
descriptionTranslationKeyin interfaceProperty<T>- Returns:
- The formatted tooltip key.
-
getUniqueId
Description copied from interface:PropertyConstructs the absolute coordinate string combining the parent category, group, and resource name.- Specified by:
getUniqueIdin interfaceProperty<T>- Returns:
- The hierarchical ID string.
-
get
-
set
-
acceptAuthoritativeUpdate
public void acceptAuthoritativeUpdate(net.minecraft.nbt.Tag tag) Description copied from interface:PropertyForces a localized state override originating from an authoritative server command or operator edit.- Specified by:
acceptAuthoritativeUpdatein interfaceProperty<T>- Parameters:
tag- The serialized NBT payload representing the authoritative state.
-
onSync
Description copied from interface:PropertyApplies an incoming network state sequence to the runtime value and sets the synchronization flag. -
onDisconnect
public void onDisconnect()Description copied from interface:PropertyExecutes local state teardown. Purges network-assigned runtime values, drops listeners, and detaches dynamic instances.- Specified by:
onDisconnectin interfaceProperty<T>
-
encodeValueToNbt
public net.minecraft.nbt.Tag encodeValueToNbt()Description copied from interface:PropertyTranslates the active runtime value into a network-transmittable NBT payload.- Specified by:
encodeValueToNbtin interfaceProperty<T>- Returns:
- The serialized Tag sequence.
-
decodeValueFromNbt
public void decodeValueFromNbt(net.minecraft.nbt.Tag tag) Description copied from interface:PropertyMutates the runtime state by parsing an incoming network transmission payload.- Specified by:
decodeValueFromNbtin interfaceProperty<T>- Parameters:
tag- The serialized NBT state data.
-
validate
-
load
public void load(com.electronwill.nightconfig.core.UnmodifiableCommentedConfig config) Description copied from interface:PropertyExtracts and applies the corresponding disk definition to the internal state variables. -
save
public void save(com.electronwill.nightconfig.core.CommentedConfig config) Description copied from interface:PropertyInjects the localized disk state and documentation string into the designated file format sequence. -
buildFormattedComment
-
appendDefaultValueComment
-
equals
-
hashCode
-
addListener
Description copied from interface:PropertyBinds an external listener sequence to the property's lifecycle broadcast collection.- Specified by:
addListenerin interfaceProperty<T>- Parameters:
listener- The callback implementation.
-
removeListener
Description copied from interface:PropertyDetaches an active listener sequence from the property's broadcast collection.- Specified by:
removeListenerin interfaceProperty<T>- Parameters:
listener- The callback implementation to purge.
-
invalidate
protected void invalidate() -
notifyChange
protected void notifyChange()
-