Record Class ToolMaterial

java.lang.Object
java.lang.Record
net.minecraft.world.item.ToolMaterial

public record ToolMaterial(TagKey<Block> incorrectBlocksForDrops, int durability, float speed, float attackDamageBonus, int enchantmentValue, TagKey<Item> repairItems) extends Record
  • Field Details

    • incorrectBlocksForDrops

      private final TagKey<Block> incorrectBlocksForDrops
      The field for the incorrectBlocksForDrops record component.
    • durability

      private final int durability
      The field for the durability record component.
    • speed

      private final float speed
      The field for the speed record component.
    • attackDamageBonus

      private final float attackDamageBonus
      The field for the attackDamageBonus record component.
    • enchantmentValue

      private final int enchantmentValue
      The field for the enchantmentValue record component.
    • repairItems

      private final TagKey<Item> repairItems
      The field for the repairItems record component.
    • WOOD

      public static final ToolMaterial WOOD
    • STONE

      public static final ToolMaterial STONE
    • IRON

      public static final ToolMaterial IRON
    • DIAMOND

      public static final ToolMaterial DIAMOND
    • GOLD

      public static final ToolMaterial GOLD
    • NETHERITE

      public static final ToolMaterial NETHERITE
  • Constructor Details

    • ToolMaterial

      public ToolMaterial(TagKey<Block> incorrectBlocksForDrops, int durability, float speed, float attackDamageBonus, int enchantmentValue, TagKey<Item> repairItems)
      Creates an instance of a ToolMaterial record class.
      Parameters:
      incorrectBlocksForDrops - the value for the incorrectBlocksForDrops record component
      durability - the value for the durability record component
      speed - the value for the speed record component
      attackDamageBonus - the value for the attackDamageBonus record component
      enchantmentValue - the value for the enchantmentValue record component
      repairItems - the value for the repairItems record component
  • Method Details

    • applyCommonProperties

      private Item.Properties applyCommonProperties(Item.Properties p_363001_)
    • applyToolProperties

      public Item.Properties applyToolProperties(Item.Properties p_361405_, TagKey<Block> p_360697_, float p_363434_, float p_364177_, float p_399983_)
    • createToolAttributes

      private ItemAttributeModifiers createToolAttributes(float p_360296_, float p_360629_)
    • applySwordProperties

      public Item.Properties applySwordProperties(Item.Properties p_363768_, float p_361044_, float p_361067_)
    • createSwordAttributes

      private ItemAttributeModifiers createSwordAttributes(float p_364643_, float p_363683_)
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components 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.
    • incorrectBlocksForDrops

      public TagKey<Block> incorrectBlocksForDrops()
      Returns the value of the incorrectBlocksForDrops record component.
      Returns:
      the value of the incorrectBlocksForDrops record component
    • durability

      public int durability()
      Returns the value of the durability record component.
      Returns:
      the value of the durability record component
    • speed

      public float speed()
      Returns the value of the speed record component.
      Returns:
      the value of the speed record component
    • attackDamageBonus

      public float attackDamageBonus()
      Returns the value of the attackDamageBonus record component.
      Returns:
      the value of the attackDamageBonus record component
    • enchantmentValue

      public int enchantmentValue()
      Returns the value of the enchantmentValue record component.
      Returns:
      the value of the enchantmentValue record component
    • repairItems

      public TagKey<Item> repairItems()
      Returns the value of the repairItems record component.
      Returns:
      the value of the repairItems record component