Class Property<T>
java.lang.Object
com.github.darksoulq.abyssallib.world.block.property.Property<T>
- Type Parameters:
T- the type of the value held by this property
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<D> DataResult<Void> decode(DynamicOps<D> ops, D input) Decodes a value from a serialized format and updates the property.<D> DataResult<D> encode(DynamicOps<D> ops) Encodes the current value into a serialized format.get()Retrieves the current value of the property.Retrieves the default value defined at creation.voidSets the change listener callback for this property.voidUpdates the current value of the property and triggers the change listener.
-
Constructor Details
-
Property
-
-
Method Details
-
onChange
Sets the change listener callback for this property.- Parameters:
onChange- the runnable to execute on changes
-
get
-
getDefault
-
set
Updates the current value of the property and triggers the change listener.- Parameters:
value- the new value to set
-
encode
Encodes the current value into a serialized format.- Type Parameters:
D- the data format type- Parameters:
ops- the dynamic operations logic- Returns:
- a DataResult containing the encoded data object
-
decode
Decodes a value from a serialized format and updates the property.- Type Parameters:
D- the data format type- Parameters:
ops- the dynamic operations logicinput- the serialized data object- Returns:
- a DataResult representing the success or partial failure of the operation
-