Class Attribute<T extends Number>
java.lang.Object
com.github.darksoulq.abyssallib.world.data.attribute.Attribute<T>
- Type Parameters:
T- The type of the attribute value (e.g. Integer, Float, Double, etc).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddModifier(net.kyori.adventure.key.Key id, T modifier, AttributeOperation operation) Adds a numeric modifier to this attribute.applyModifiers(T base) Applies all active modifiers to a given base value.Returns the default value of this attribute.Map<net.kyori.adventure.key.Key, AttributeModifier<T>> Returns the map of identifier:attribute modifierkey()Returns the unique key used to identify this attribute.voidremoveModifier(net.kyori.adventure.key.Key id) Removes a modifier from this attribute using its identifier.type()Returns the Java class representing the type of this attribute.
-
Constructor Details
-
Attribute
-
-
Method Details
-
key
Returns the unique key used to identify this attribute.- Returns:
- the attribute key
-
type
-
defaultValue
-
addModifier
Adds a numeric modifier to this attribute. Has no effect if the type is not a supported number type.- Parameters:
id- The identifier for this modifier.modifier- The modifier value.operation- The arithmetic operation to apply.
-
removeModifier
public void removeModifier(net.kyori.adventure.key.Key id) Removes a modifier from this attribute using its identifier.- Parameters:
id- The identifier of the modifier to remove.
-
getModifiers
Returns the map of identifier:attribute modifier- Returns:
- The attribute modifier map
-
applyModifiers
-