Class AttributeInstance

java.lang.Object
net.minestom.server.attribute.AttributeInstance

public final class AttributeInstance extends Object
Represents an instance of an attribute and its modifiers.
  • Constructor Details

  • Method Details

    • getAttribute

      @NotNull public @NotNull Attribute getAttribute()
      Gets the attribute associated to this instance.
      Returns:
      the associated attribute
    • getBaseValue

      public float getBaseValue()
      The base value of this instance without modifiers
      Returns:
      the instance base value
      See Also:
    • setBaseValue

      public void setBaseValue(float baseValue)
      Sets the base value of this instance.
      Parameters:
      baseValue - the new base value
      See Also:
    • addModifier

      public void addModifier(@NotNull @NotNull AttributeModifier modifier)
      Add a modifier to this instance.
      Parameters:
      modifier - the modifier to add
    • removeModifier

      public void removeModifier(@NotNull @NotNull AttributeModifier modifier)
      Remove a modifier from this instance.
      Parameters:
      modifier - the modifier to remove
    • removeModifier

      public void removeModifier(@NotNull @NotNull UUID uuid)
      Remove a modifier from this instance.
      Parameters:
      uuid - The UUID of the modifier to remove
    • getModifiers

      @NotNull public @NotNull Collection<AttributeModifier> getModifiers()
      Get the modifiers applied to this instance.
      Returns:
      the modifiers.
    • getValue

      public float getValue()
      Gets the value of this instance calculated with modifiers applied.
      Returns:
      the attribute value