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 Summary
FieldsModifier and TypeFieldDescriptionprivate final intThe field for theanvilCostrecord component.static final com.mojang.serialization.MapCodec<Enchantment.EnchantmentDefinition> private final Enchantment.CostThe field for themaxCostrecord component.private final intThe field for themaxLevelrecord component.private final Enchantment.CostThe field for theminCostrecord component.The field for theprimaryItemsrecord component.private final List<EquipmentSlotGroup> The field for theslotsrecord component.The field for thesupportedItemsrecord component.private final intThe field for theweightrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionEnchantmentDefinition(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 aEnchantmentDefinitionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of theanvilCostrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.maxCost()Returns the value of themaxCostrecord component.intmaxLevel()Returns the value of themaxLevelrecord component.minCost()Returns the value of theminCostrecord component.Returns the value of theprimaryItemsrecord component.slots()Returns the value of theslotsrecord component.Returns the value of thesupportedItemsrecord component.final StringtoString()Returns a string representation of this record class.intweight()Returns the value of theweightrecord component.
-
Field Details
-
supportedItems
-
-
weight
private final int weightThe field for theweightrecord component. -
maxLevel
private final int maxLevelThe field for themaxLevelrecord component. -
minCost
The field for theminCostrecord component. -
maxCost
The field for themaxCostrecord component. -
anvilCost
private final int anvilCostThe field for theanvilCostrecord component. -
slots
The field for theslotsrecord component. -
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 aEnchantmentDefinitionrecord class.- Parameters:
supportedItems- the value for thesupportedItemsrecord componentprimaryItems- the value for theprimaryItemsrecord componentweight- the value for theweightrecord componentmaxLevel- the value for themaxLevelrecord componentminCost- the value for theminCostrecord componentmaxCost- the value for themaxCostrecord componentanvilCost- the value for theanvilCostrecord componentslots- the value for theslotsrecord component
-
-
Method Details
-
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. -
supportedItems
-
primaryItems
-
weight
public int weight()Returns the value of theweightrecord component.- Returns:
- the value of the
weightrecord component
-
maxLevel
public int maxLevel()Returns the value of themaxLevelrecord component.- Returns:
- the value of the
maxLevelrecord component
-
minCost
Returns the value of theminCostrecord component.- Returns:
- the value of the
minCostrecord component
-
maxCost
Returns the value of themaxCostrecord component.- Returns:
- the value of the
maxCostrecord component
-
anvilCost
public int anvilCost()Returns the value of theanvilCostrecord component.- Returns:
- the value of the
anvilCostrecord component
-
slots
Returns the value of theslotsrecord component.- Returns:
- the value of the
slotsrecord component
-