Record Class ToolStats

java.lang.Object
java.lang.Record
net.xun.armory.api.item.tools.ToolStats
Record Components:
attackDamage - the base attack damage added to the tier's bonus
attackSpeed - the attack speed value (e.g., 1.6 for swords)

public record ToolStats(float attackDamage, float attackSpeed) extends Record
Container for attack damage and attack speed values for a tool piece.

These stats are combined with the Tier base damage to compute the final attack damage attribute. The attack speed is stored as the actual value (e.g., 1.6) and is adjusted during attribute application (subtracted by 4 to match Minecraft's internal base speed).

This record also provides default constants for vanilla and common modded tool types.

Since:
3.0.0
  • Field Details

    • ZERO

      public static final ToolStats ZERO
    • DEFAULT_SWORD

      public static final ToolStats DEFAULT_SWORD
    • DEFAULT_AXE

      public static final ToolStats DEFAULT_AXE
    • DEFAULT_PICKAXE

      public static final ToolStats DEFAULT_PICKAXE
    • DEFAULT_SHOVEL

      public static final ToolStats DEFAULT_SHOVEL
    • DEFAULT_HOE

      public static final ToolStats DEFAULT_HOE
    • DEFAULT_KNIFE

      public static final ToolStats DEFAULT_KNIFE
  • Constructor Details

    • ToolStats

      public ToolStats(float attackDamage, float attackSpeed)
      Creates an instance of a ToolStats record class.
      Parameters:
      attackDamage - the value for the attackDamage record component
      attackSpeed - the value for the attackSpeed record component
  • Method Details

    • addBaseAttributes

      public void addBaseAttributes(net.minecraft.world.item.Tier tier, net.minecraft.world.item.component.ItemAttributeModifiers.Builder builder)
      Applies the attack damage and speed attributes to the given builder, using the provided tier to compute the final damage bonus.
      Parameters:
      tier - the material tier (provides base attack damage bonus)
      builder - the attribute builder to modify
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • attackDamage

      public float attackDamage()
      Returns the value of the attackDamage record component.
      Returns:
      the value of the attackDamage record component
    • attackSpeed

      public float attackSpeed()
      Returns the value of the attackSpeed record component.
      Returns:
      the value of the attackSpeed record component