Record Class Enchantment.Cost
java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.Enchantment.Cost
- Enclosing class:
Enchantment
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intThe field for thebaserecord component.static final com.mojang.serialization.Codec<Enchantment.Cost> private final intThe field for theperLevelAboveFirstrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionCost(int base, int perLevelAboveFirst) Creates an instance of aCostrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintbase()Returns the value of thebaserecord component.intcalculate(int level) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of theperLevelAboveFirstrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
base
private final int baseThe field for thebaserecord component. -
perLevelAboveFirst
private final int perLevelAboveFirstThe field for theperLevelAboveFirstrecord component. -
CODEC
-
-
Constructor Details
-
Cost
public Cost(int base, int perLevelAboveFirst) Creates an instance of aCostrecord class.- Parameters:
base- the value for thebaserecord componentperLevelAboveFirst- the value for theperLevelAboveFirstrecord component
-
-
Method Details
-
calculate
public int calculate(int level) -
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. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
base
public int base()Returns the value of thebaserecord component.- Returns:
- the value of the
baserecord component
-
perLevelAboveFirst
public int perLevelAboveFirst()Returns the value of theperLevelAboveFirstrecord component.- Returns:
- the value of the
perLevelAboveFirstrecord component
-