Record Class ToolUsage

java.lang.Object
java.lang.Record
com.minecolonies.core.colony.crafting.ToolUsage
Record Components:
tool - the tool type
toolLevels - basic items accepted at each building level.
enchantedToolLevels - (some) enchanted items accepted at each building level.

public record ToolUsage(@NotNull EquipmentTypeEntry tool, @NotNull List<List<net.minecraft.world.item.ItemStack>> toolLevels, @NotNull List<List<net.minecraft.world.item.ItemStack>> enchantedToolLevels) extends Record
Describes a tool and its level compatibility.
  • Constructor Details

    • ToolUsage

      public ToolUsage(@NotNull @NotNull EquipmentTypeEntry tool, @NotNull @NotNull List<List<net.minecraft.world.item.ItemStack>> toolLevels, @NotNull @NotNull List<List<net.minecraft.world.item.ItemStack>> enchantedToolLevels)
      Creates an instance of a ToolUsage record class.
      Parameters:
      tool - the value for the tool record component
      toolLevels - the value for the toolLevels record component
      enchantedToolLevels - the value for the enchantedToolLevels record component
  • Method Details

    • create

      @NotNull public static @NotNull ToolUsage create(@NotNull @NotNull EquipmentTypeEntry tool)
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • tool

      @NotNull public @NotNull EquipmentTypeEntry tool()
      Returns the value of the tool record component.
      Returns:
      the value of the tool record component
    • toolLevels

      @NotNull public @NotNull List<List<net.minecraft.world.item.ItemStack>> toolLevels()
      Returns the value of the toolLevels record component.
      Returns:
      the value of the toolLevels record component
    • enchantedToolLevels

      @NotNull public @NotNull List<List<net.minecraft.world.item.ItemStack>> enchantedToolLevels()
      Returns the value of the enchantedToolLevels record component.
      Returns:
      the value of the enchantedToolLevels record component