Record Class Enchantment.EnchantmentDefinition

java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.Enchantment.EnchantmentDefinition
Enclosing class:
Enchantment

public static record Enchantment.EnchantmentDefinition(HolderSet<Item> supportedItems, Optional<HolderSet<Item>> primaryItems, int weight, int maxLevel, Enchantment.Cost minCost, Enchantment.Cost maxCost, int anvilCost, List<EquipmentSlotGroup> slots) extends Record
  • Field Details

    • supportedItems

      private final HolderSet<Item> supportedItems
      The field for the supportedItems record component.
    • primaryItems

      private final Optional<HolderSet<Item>> primaryItems
      The field for the primaryItems record component.
    • weight

      private final int weight
      The field for the weight record component.
    • maxLevel

      private final int maxLevel
      The field for the maxLevel record component.
    • minCost

      private final Enchantment.Cost minCost
      The field for the minCost record component.
    • maxCost

      private final Enchantment.Cost maxCost
      The field for the maxCost record component.
    • anvilCost

      private final int anvilCost
      The field for the anvilCost record component.
    • slots

      private final List<EquipmentSlotGroup> slots
      The field for the slots record component.
    • CODEC

      public static final com.mojang.serialization.MapCodec<Enchantment.EnchantmentDefinition> CODEC
  • Constructor Details

    • EnchantmentDefinition

      public EnchantmentDefinition(HolderSet<Item> supportedItems, Optional<HolderSet<Item>> primaryItems, int weight, int maxLevel, Enchantment.Cost minCost, Enchantment.Cost maxCost, int anvilCost, List<EquipmentSlotGroup> slots)
      Creates an instance of a EnchantmentDefinition record class.
      Parameters:
      supportedItems - the value for the supportedItems record component
      primaryItems - the value for the primaryItems record component
      weight - the value for the weight record component
      maxLevel - the value for the maxLevel record component
      minCost - the value for the minCost record component
      maxCost - the value for the maxCost record component
      anvilCost - the value for the anvilCost record component
      slots - the value for the slots record component
  • Method Details

    • 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.
    • supportedItems

      public HolderSet<Item> supportedItems()
      Returns the value of the supportedItems record component.
      Returns:
      the value of the supportedItems record component
    • primaryItems

      public Optional<HolderSet<Item>> primaryItems()
      Returns the value of the primaryItems record component.
      Returns:
      the value of the primaryItems record component
    • weight

      public int weight()
      Returns the value of the weight record component.
      Returns:
      the value of the weight record component
    • maxLevel

      public int maxLevel()
      Returns the value of the maxLevel record component.
      Returns:
      the value of the maxLevel record component
    • minCost

      public Enchantment.Cost minCost()
      Returns the value of the minCost record component.
      Returns:
      the value of the minCost record component
    • maxCost

      public Enchantment.Cost maxCost()
      Returns the value of the maxCost record component.
      Returns:
      the value of the maxCost record component
    • anvilCost

      public int anvilCost()
      Returns the value of the anvilCost record component.
      Returns:
      the value of the anvilCost record component
    • slots

      public List<EquipmentSlotGroup> slots()
      Returns the value of the slots record component.
      Returns:
      the value of the slots record component