Package net.minecraft.world.item
Record Class ToolMaterial
java.lang.Object
java.lang.Record
net.minecraft.world.item.ToolMaterial
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final floatThe field for theattackDamageBonusrecord component.static final ToolMaterialprivate final intThe field for thedurabilityrecord component.private final intThe field for theenchantmentValuerecord component.static final ToolMaterialThe field for theincorrectBlocksForDropsrecord component.static final ToolMaterialstatic final ToolMaterialThe field for therepairItemsrecord component.private final floatThe field for thespeedrecord component.static final ToolMaterialstatic final ToolMaterial -
Constructor Summary
ConstructorsConstructorDescriptionToolMaterial(TagKey<Block> incorrectBlocksForDrops, int durability, float speed, float attackDamageBonus, int enchantmentValue, TagKey<Item> repairItems) Creates an instance of aToolMaterialrecord class. -
Method Summary
Modifier and TypeMethodDescriptionprivate Item.PropertiesapplyCommonProperties(Item.Properties pProperties) applySwordProperties(Item.Properties pProperties, float pAttackDamage, float pAttackSpeed) applyToolProperties(Item.Properties pProperties, TagKey<Block> pMineableBlocks, float pAttackDamage, float pAttackSpeed, float pDisableBlockingForSeconfs) floatReturns the value of theattackDamageBonusrecord component.private ItemAttributeModifierscreateSwordAttributes(float pAttackDamage, float pAttackSpeed) private ItemAttributeModifierscreateToolAttributes(float pAttackDamage, float pAttackSpeed) intReturns the value of thedurabilityrecord component.intReturns the value of theenchantmentValuerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theincorrectBlocksForDropsrecord component.Returns the value of therepairItemsrecord component.floatspeed()Returns the value of thespeedrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
incorrectBlocksForDrops
The field for theincorrectBlocksForDropsrecord component. -
durability
private final int durabilityThe field for thedurabilityrecord component. -
speed
private final float speedThe field for thespeedrecord component. -
attackDamageBonus
private final float attackDamageBonusThe field for theattackDamageBonusrecord component. -
enchantmentValue
private final int enchantmentValueThe field for theenchantmentValuerecord component. -
repairItems
The field for therepairItemsrecord component. -
WOOD
-
STONE
-
IRON
-
DIAMOND
-
GOLD
-
NETHERITE
-
-
Constructor Details
-
ToolMaterial
public ToolMaterial(TagKey<Block> incorrectBlocksForDrops, int durability, float speed, float attackDamageBonus, int enchantmentValue, TagKey<Item> repairItems) Creates an instance of aToolMaterialrecord class.- Parameters:
incorrectBlocksForDrops- the value for theincorrectBlocksForDropsrecord componentdurability- the value for thedurabilityrecord componentspeed- the value for thespeedrecord componentattackDamageBonus- the value for theattackDamageBonusrecord componentenchantmentValue- the value for theenchantmentValuerecord componentrepairItems- the value for therepairItemsrecord component
-
-
Method Details
-
applyCommonProperties
-
applyToolProperties
public Item.Properties applyToolProperties(Item.Properties pProperties, TagKey<Block> pMineableBlocks, float pAttackDamage, float pAttackSpeed, float pDisableBlockingForSeconfs) -
createToolAttributes
-
applySwordProperties
public Item.Properties applySwordProperties(Item.Properties pProperties, float pAttackDamage, float pAttackSpeed) -
createSwordAttributes
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
incorrectBlocksForDrops
Returns the value of theincorrectBlocksForDropsrecord component.- Returns:
- the value of the
incorrectBlocksForDropsrecord component
-
durability
public int durability()Returns the value of thedurabilityrecord component.- Returns:
- the value of the
durabilityrecord component
-
speed
public float speed()Returns the value of thespeedrecord component.- Returns:
- the value of the
speedrecord component
-
attackDamageBonus
public float attackDamageBonus()Returns the value of theattackDamageBonusrecord component.- Returns:
- the value of the
attackDamageBonusrecord component
-
enchantmentValue
public int enchantmentValue()Returns the value of theenchantmentValuerecord component.- Returns:
- the value of the
enchantmentValuerecord component
-
repairItems
Returns the value of therepairItemsrecord component.- Returns:
- the value of the
repairItemsrecord component
-