Package net.xun.armory.api.item.tools
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 bonusattackSpeed- the attack speed value (e.g., 1.6 for swords)
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionToolStats(float attackDamage, float attackSpeed) Creates an instance of aToolStatsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBaseAttributes(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.floatReturns the value of theattackDamagerecord component.floatReturns the value of theattackSpeedrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
ZERO
-
DEFAULT_SWORD
-
DEFAULT_AXE
-
DEFAULT_PICKAXE
-
DEFAULT_SHOVEL
-
DEFAULT_HOE
-
DEFAULT_KNIFE
-
-
Constructor Details
-
ToolStats
public ToolStats(float attackDamage, float attackSpeed) Creates an instance of aToolStatsrecord class.- Parameters:
attackDamage- the value for theattackDamagerecord componentattackSpeed- the value for theattackSpeedrecord 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
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. -
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. -
equals
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 '=='. -
attackDamage
public float attackDamage()Returns the value of theattackDamagerecord component.- Returns:
- the value of the
attackDamagerecord component
-
attackSpeed
public float attackSpeed()Returns the value of theattackSpeedrecord component.- Returns:
- the value of the
attackSpeedrecord component
-