Class SlimePropertyMap
java.lang.Object
com.infernalsuite.asp.api.world.properties.SlimePropertyMap
A Property Map object.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()static SlimePropertyMapfromCompound(net.kyori.adventure.nbt.CompoundBinaryTag tag) <T,Z extends net.kyori.adventure.nbt.BinaryTag>
Optional<T> getOptionalValue(SlimeProperty<T, Z> property) Return the current value of the given property as an Optional Instead of returning the default value if the property is not set, it returns an empty OptionalReturn the properties (CompoundMap)<T,Z extends net.kyori.adventure.nbt.BinaryTag>
TgetValue(SlimeProperty<T, Z> property) Return the current value of the given propertyvoidmerge(SlimePropertyMap other) Copies all values from the specifiedSlimePropertyMap.<T,Z extends net.kyori.adventure.nbt.BinaryTag>
voidsetValue(SlimeProperty<T, Z> property, T value) Update the value of the given propertynet.kyori.adventure.nbt.CompoundBinaryTagReturns aCompoundBinaryTagcontaining every property set in this map.toString()
-
Constructor Details
-
SlimePropertyMap
public SlimePropertyMap() -
SlimePropertyMap
-
-
Method Details
-
getValue
Return the current value of the given property- Parameters:
property- The slime property- Returns:
- The current value
-
getOptionalValue
public <T,Z extends net.kyori.adventure.nbt.BinaryTag> Optional<T> getOptionalValue(SlimeProperty<T, Z> property) Return the current value of the given property as an Optional Instead of returning the default value if the property is not set, it returns an empty Optional- Parameters:
property- The slime property- Returns:
- An Optional containing the current value, or empty if not set
-
getProperties
Return the properties (CompoundMap)- Returns:
- The properties
-
setValue
public <T,Z extends net.kyori.adventure.nbt.BinaryTag> void setValue(SlimeProperty<T, Z> property, T value) Update the value of the given property- Parameters:
property- The slime propertyvalue- The new value- Throws:
IllegalArgumentException- if the value fails validation.
-
merge
Copies all values from the specifiedSlimePropertyMap. If the same property has different values on both maps, the one on the provided map will be used.- Parameters:
other- ASlimePropertyMap.
-
toCompound
public net.kyori.adventure.nbt.CompoundBinaryTag toCompound()Returns aCompoundBinaryTagcontaining every property set in this map.- Returns:
- A
CompoundBinaryTagwith all the properties stored in this map.
-
fromCompound
-
clone
-
toString
-