Class AttributeModifier<T extends Number>

java.lang.Object
com.github.darksoulq.abyssallib.world.data.attribute.AttributeModifier<T>
Type Parameters:
T - The numeric type of the attribute being modified, extending Number.

public class AttributeModifier<T extends Number> extends Object
Represents a modifier applied to an attribute's base value. This class supports arithmetic operations including addition, subtraction, multiplication, and division for a wide variety of numeric types.
  • Constructor Details

    • AttributeModifier

      public AttributeModifier(T value, AttributeOperation operation)
      Constructs a new attribute modifier with a specific value and operation type.
      Parameters:
      value - The numeric value to apply as a modifier.
      operation - The AttributeOperation defining how the value interacts with the base.
  • Method Details

    • getValue

      public T getValue()
      Retrieves the raw numeric value associated with this modifier.
      Returns:
      The modifier value of type T.
    • getOperation

      public AttributeOperation getOperation()
      Retrieves the specific arithmetic operation performed by this modifier.
      Returns:
      The AttributeOperation constant representing the operation.
    • applyToInt

      public int applyToInt(int base)
      Applies this modifier to an integer base value.
      Parameters:
      base - The original base value to be modified.
      Returns:
      The resulting modified integer value.
    • applyToFloat

      public float applyToFloat(float base)
      Applies this modifier to a floating-point base value.
      Parameters:
      base - The original base value to be modified.
      Returns:
      The resulting modified float value.
    • applyToDouble

      public double applyToDouble(double base)
      Applies this modifier to a double-precision base value.
      Parameters:
      base - The original base value to be modified.
      Returns:
      The resulting modified double value.
    • applyToLong

      public long applyToLong(long base)
      Applies this modifier to a long integer base value.
      Parameters:
      base - The original base value to be modified.
      Returns:
      The resulting modified long value.
    • applyToShort

      public short applyToShort(short base)
      Applies this modifier to a short integer base value.
      Parameters:
      base - The original base value to be modified.
      Returns:
      The resulting modified short value.
    • applyToByte

      public byte applyToByte(byte base)
      Applies this modifier to a byte base value.
      Parameters:
      base - The original base value to be modified.
      Returns:
      The resulting modified byte value.
    • applyToBigDecimal

      public BigDecimal applyToBigDecimal(BigDecimal base)
      Applies this modifier to a BigDecimal base value for high-precision arithmetic.
      Parameters:
      base - The original base value to be modified.
      Returns:
      The resulting modified BigDecimal value.