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

  • Constructor Details

    • DefaultProperty

      protected DefaultProperty(String resourceName, Group category, ConfigScope scope, String comment, T defaultValue, com.mojang.serialization.Codec<T> codec, boolean isDynamic)
  • Method Details

    • resourceName

      public String resourceName()
      Description copied from interface: Property
      Retrieves the exact registry identifier of the property.
      Specified by:
      resourceName in interface Property<T>
      Returns:
      The resource string.
    • parentGroup

      public Group parentGroup()
      Description copied from interface: Property
      Retrieves the structural group encapsulating this property.
      Specified by:
      parentGroup in interface Property<T>
      Returns:
      The bound Group instance.
    • defaultValue

      public T defaultValue()
      Description copied from interface: Property
      Retrieves the baseline state assigned during instantiation prior to modifications or disk loads.
      Specified by:
      defaultValue in interface Property<T>
      Returns:
      The initial default value.
    • codec

      public com.mojang.serialization.Codec<T> codec()
      Description copied from interface: Property
      Retrieves the serialization protocol required to translate the property state to and from external formats.
      Specified by:
      codec in interface Property<T>
      Returns:
      The bound Codec instance.
    • scope

      public ConfigScope scope()
      Description copied from interface: Property
      Retrieves the operational boundary and synchronization policy governing the property.
      Specified by:
      scope in interface Property<T>
      Returns:
      The designated ConfigScope.
    • comment

      public String comment()
      Description copied from interface: Property
      Retrieves the supplementary text sequence injected during disk serialization.
      Specified by:
      comment in interface Property<T>
      Returns:
      The documentation string, or null if unassigned.
    • isDynamic

      public boolean isDynamic()
      Description copied from interface: Property
      Determines if the property was constructed dynamically at runtime rather than via static allocation.
      Specified by:
      isDynamic in interface Property<T>
      Returns:
      True if the property was dynamically injected.
    • translationKey

      public String translationKey()
      Description copied from interface: Property
      Retrieves the base localization key utilized for client-side GUI title translation.
      Specified by:
      translationKey in interface Property<T>
      Returns:
      The formatted translation key.
    • descriptionTranslationKey

      public String descriptionTranslationKey()
      Description copied from interface: Property
      Retrieves the extended localization key utilized for client-side GUI tooltip translation.
      Specified by:
      descriptionTranslationKey in interface Property<T>
      Returns:
      The formatted tooltip key.
    • getUniqueId

      public String getUniqueId()
      Description copied from interface: Property
      Constructs the absolute coordinate string combining the parent category, group, and resource name.
      Specified by:
      getUniqueId in interface Property<T>
      Returns:
      The hierarchical ID string.
    • get

      public T get()
      Description copied from interface: Property
      Retrieves the active runtime state.
      Specified by:
      get in interface Property<T>
      Returns:
      The current memory value.
    • set

      public void set(T newValue)
      Description copied from interface: Property
      Mutates the active runtime and disk states, automatically broadcasting the transition to registered listeners.
      Specified by:
      set in interface Property<T>
      Parameters:
      newValue - The requested state mutation.
    • acceptAuthoritativeUpdate

      public void acceptAuthoritativeUpdate(net.minecraft.nbt.Tag tag)
      Description copied from interface: Property
      Forces a localized state override originating from an authoritative server command or operator edit.
      Specified by:
      acceptAuthoritativeUpdate in interface Property<T>
      Parameters:
      tag - The serialized NBT payload representing the authoritative state.
    • onSync

      public void onSync(T serverValue)
      Description copied from interface: Property
      Applies an incoming network state sequence to the runtime value and sets the synchronization flag.
      Specified by:
      onSync in interface Property<T>
      Parameters:
      serverValue - The deserialized value transmitted by the authoritative server.
    • onDisconnect

      public void onDisconnect()
      Description copied from interface: Property
      Executes local state teardown. Purges network-assigned runtime values, drops listeners, and detaches dynamic instances.
      Specified by:
      onDisconnect in interface Property<T>
    • encodeValueToNbt

      public net.minecraft.nbt.Tag encodeValueToNbt()
      Description copied from interface: Property
      Translates the active runtime value into a network-transmittable NBT payload.
      Specified by:
      encodeValueToNbt in interface Property<T>
      Returns:
      The serialized Tag sequence.
    • decodeValueFromNbt

      public void decodeValueFromNbt(net.minecraft.nbt.Tag tag)
      Description copied from interface: Property
      Mutates the runtime state by parsing an incoming network transmission payload.
      Specified by:
      decodeValueFromNbt in interface Property<T>
      Parameters:
      tag - The serialized NBT state data.
    • validate

      protected T validate(T value)
    • load

      public void load(com.electronwill.nightconfig.core.UnmodifiableCommentedConfig config)
      Description copied from interface: Property
      Extracts and applies the corresponding disk definition to the internal state variables.
      Specified by:
      load in interface Property<T>
      Parameters:
      config - The structural disk model holding the property value.
    • save

      public void save(com.electronwill.nightconfig.core.CommentedConfig config)
      Description copied from interface: Property
      Injects the localized disk state and documentation string into the designated file format sequence.
      Specified by:
      save in interface Property<T>
      Parameters:
      config - The target structural disk model.
    • buildFormattedComment

      protected String buildFormattedComment()
    • appendDefaultValueComment

      protected void appendDefaultValueComment(StringBuilder builder)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • addListener

      public void addListener(Property.Listener listener)
      Description copied from interface: Property
      Binds an external listener sequence to the property's lifecycle broadcast collection.
      Specified by:
      addListener in interface Property<T>
      Parameters:
      listener - The callback implementation.
    • removeListener

      public void removeListener(Property.Listener listener)
      Description copied from interface: Property
      Detaches an active listener sequence from the property's broadcast collection.
      Specified by:
      removeListener in interface Property<T>
      Parameters:
      listener - The callback implementation to purge.
    • invalidate

      protected void invalidate()
    • notifyChange

      protected void notifyChange()