Record Class EnchantmentPredicate
java.lang.Object
java.lang.Record
net.minecraft.advancements.criterion.EnchantmentPredicate
public record EnchantmentPredicate(Optional<HolderSet<Enchantment>> enchantments, MinMaxBounds.Ints level)
extends Record
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<EnchantmentPredicate> private final Optional<HolderSet<Enchantment>> The field for theenchantmentsrecord component.private final MinMaxBounds.IntsThe field for thelevelrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionEnchantmentPredicate(Optional<HolderSet<Enchantment>> enchantments, MinMaxBounds.Ints level) Creates an instance of aEnchantmentPredicaterecord class.EnchantmentPredicate(Holder<Enchantment> enchantment, MinMaxBounds.Ints level) EnchantmentPredicate(HolderSet<Enchantment> enchantments, MinMaxBounds.Ints level) -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainedIn(ItemEnchantments itemEnchantments) Returns the value of theenchantmentsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.level()Returns the value of thelevelrecord component.private booleanmatchesEnchantment(ItemEnchantments itemEnchantments, Holder<Enchantment> enchantment) final StringtoString()Returns a string representation of this record class.
-
Field Details
-
enchantments
The field for theenchantmentsrecord component. -
level
The field for thelevelrecord component. -
CODEC
-
-
Constructor Details
-
EnchantmentPredicate
-
EnchantmentPredicate
-
EnchantmentPredicate
Creates an instance of aEnchantmentPredicaterecord class.- Parameters:
enchantments- the value for theenchantmentsrecord componentlevel- the value for thelevelrecord component
-
-
Method Details
-
containedIn
-
matchesEnchantment
private boolean matchesEnchantment(ItemEnchantments itemEnchantments, Holder<Enchantment> enchantment) -
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 withObjects::equals(Object,Object). -
enchantments
Returns the value of theenchantmentsrecord component.- Returns:
- the value of the
enchantmentsrecord component
-
level
Returns the value of thelevelrecord component.- Returns:
- the value of the
levelrecord component
-