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 float
The field for theattackDamageBonus
record component.static final ToolMaterial
private final int
The field for thedurability
record component.private final int
The field for theenchantmentValue
record component.static final ToolMaterial
The field for theincorrectBlocksForDrops
record component.static final ToolMaterial
static final ToolMaterial
The field for therepairItems
record component.private final float
The field for thespeed
record component.static final ToolMaterial
static final ToolMaterial
-
Constructor Summary
ConstructorsConstructorDescriptionToolMaterial
(TagKey<Block> incorrectBlocksForDrops, int durability, float speed, float attackDamageBonus, int enchantmentValue, TagKey<Item> repairItems) Creates an instance of aToolMaterial
record class. -
Method Summary
Modifier and TypeMethodDescriptionprivate Item.Properties
applyCommonProperties
(Item.Properties p_363001_) applySwordProperties
(Item.Properties p_363768_, float p_361044_, float p_361067_) applyToolProperties
(Item.Properties p_361405_, TagKey<Block> p_360697_, float p_363434_, float p_364177_, float p_399983_) float
Returns the value of theattackDamageBonus
record component.private ItemAttributeModifiers
createSwordAttributes
(float p_364643_, float p_363683_) private ItemAttributeModifiers
createToolAttributes
(float p_360296_, float p_360629_) int
Returns the value of thedurability
record component.int
Returns the value of theenchantmentValue
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.Returns the value of theincorrectBlocksForDrops
record component.Returns the value of therepairItems
record component.float
speed()
Returns the value of thespeed
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
incorrectBlocksForDrops
The field for theincorrectBlocksForDrops
record component. -
durability
private final int durabilityThe field for thedurability
record component. -
speed
private final float speedThe field for thespeed
record component. -
attackDamageBonus
private final float attackDamageBonusThe field for theattackDamageBonus
record component. -
enchantmentValue
private final int enchantmentValueThe field for theenchantmentValue
record component. -
repairItems
The field for therepairItems
record 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 aToolMaterial
record class.- Parameters:
incorrectBlocksForDrops
- the value for theincorrectBlocksForDrops
record componentdurability
- the value for thedurability
record componentspeed
- the value for thespeed
record componentattackDamageBonus
- the value for theattackDamageBonus
record componentenchantmentValue
- the value for theenchantmentValue
record componentrepairItems
- the value for therepairItems
record component
-
-
Method Details
-
applyCommonProperties
-
applyToolProperties
public Item.Properties applyToolProperties(Item.Properties p_361405_, TagKey<Block> p_360697_, float p_363434_, float p_364177_, float p_399983_) -
createToolAttributes
-
applySwordProperties
public Item.Properties applySwordProperties(Item.Properties p_363768_, float p_361044_, float p_361067_) -
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 theincorrectBlocksForDrops
record component.- Returns:
- the value of the
incorrectBlocksForDrops
record component
-
durability
public int durability()Returns the value of thedurability
record component.- Returns:
- the value of the
durability
record component
-
speed
public float speed()Returns the value of thespeed
record component.- Returns:
- the value of the
speed
record component
-
attackDamageBonus
public float attackDamageBonus()Returns the value of theattackDamageBonus
record component.- Returns:
- the value of the
attackDamageBonus
record component
-
enchantmentValue
public int enchantmentValue()Returns the value of theenchantmentValue
record component.- Returns:
- the value of the
enchantmentValue
record component
-
repairItems
Returns the value of therepairItems
record component.- Returns:
- the value of the
repairItems
record component
-