Record Class EnchantmentPredicate
java.lang.Object
java.lang.Record
net.minecraft.advancements.critereon.EnchantmentPredicate
public record EnchantmentPredicate(Optional<HolderSet<Enchantment>> enchantments, MinMaxBounds.Ints level)
extends Record
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec
<EnchantmentPredicate> private final Optional
<HolderSet<Enchantment>> The field for theenchantments
record component.private final MinMaxBounds.Ints
The field for thelevel
record component. -
Constructor Summary
ConstructorDescriptionEnchantmentPredicate
(Optional<HolderSet<Enchantment>> enchantments, MinMaxBounds.Ints level) Creates an instance of aEnchantmentPredicate
record class.EnchantmentPredicate
(Holder<Enchantment> p_342794_, MinMaxBounds.Ints p_343999_) EnchantmentPredicate
(HolderSet<Enchantment> p_343165_, MinMaxBounds.Ints p_30472_) -
Method Summary
Modifier and TypeMethodDescriptionboolean
containedIn
(ItemEnchantments p_334667_) Returns the value of theenchantments
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.level()
Returns the value of thelevel
record component.private boolean
matchesEnchantment
(ItemEnchantments p_342239_, Holder<Enchantment> p_342249_) final String
toString()
Returns a string representation of this record class.
-
Field Details
-
enchantments
The field for theenchantments
record component. -
level
The field for thelevel
record component. -
CODEC
-
-
Constructor Details
-
EnchantmentPredicate
-
EnchantmentPredicate
-
EnchantmentPredicate
Creates an instance of aEnchantmentPredicate
record class.- Parameters:
enchantments
- the value for theenchantments
record componentlevel
- the value for thelevel
record component
-
-
Method Details
-
containedIn
-
matchesEnchantment
-
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. -
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. -
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 theenchantments
record component.- Returns:
- the value of the
enchantments
record component
-
level
Returns the value of thelevel
record component.- Returns:
- the value of the
level
record component
-