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 ToolMaterialstatic 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 properties) applySwordProperties(Item.Properties properties, float attackDamageBaseline, float attackSpeedBaseline) applyToolProperties(Item.Properties properties, TagKey<Block> minesEfficiently, float attackDamageBaseline, float attackSpeedBaseline, float disableBlockingSeconds) floatReturns the value of theattackDamageBonusrecord component.private ItemAttributeModifierscreateSwordAttributes(float attackDamageBaseline, float attackSpeedBaseline) private ItemAttributeModifierscreateToolAttributes(float attackDamageBaseline, float attackSpeedBaseline) 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
-
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
-
WOOD
-
STONE
-
COPPER
-
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 properties, TagKey<Block> minesEfficiently, float attackDamageBaseline, float attackSpeedBaseline, float disableBlockingSeconds) -
createToolAttributes
private ItemAttributeModifiers createToolAttributes(float attackDamageBaseline, float attackSpeedBaseline) -
applySwordProperties
public Item.Properties applySwordProperties(Item.Properties properties, float attackDamageBaseline, float attackSpeedBaseline) -
createSwordAttributes
private ItemAttributeModifiers createSwordAttributes(float attackDamageBaseline, float attackSpeedBaseline) -
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
incorrectBlocksForDrops
-
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
-