Record Class DataComponentPredicate.EnchantmentListPredicate
java.lang.Object
java.lang.Record
net.minestom.server.instance.block.predicate.DataComponentPredicate.EnchantmentListPredicate
- Record Components:
enchantments- The enchantments to search forlevels- The acceptable range of enchantment levels
- All Implemented Interfaces:
Predicate<EnchantmentList>
- Enclosing interface:
DataComponentPredicate
public static record DataComponentPredicate.EnchantmentListPredicate(@Nullable RegistryTag<Enchantment> enchantments, Range.Int levels)
extends Record
implements Predicate<EnchantmentList>
Tests enchantments. Possible cases:
- If
enchantmentsis present andlevelsis present, then the object must contain at least one matching enchantment with a matching level. - If
enchantmentsis present andlevelsis not present, then the object must contain at least one matching enchantment at any level. - If
enchantmentsis not present andlevelsis present, then the object must contain at least one enchantment with a matching level. - If both
enchantmentsandlevelsare not present, then the object must have at least one enchantment at any level.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<DataComponentPredicate.EnchantmentListPredicate> -
Constructor Summary
ConstructorsConstructorDescriptionEnchantmentListPredicate(@Nullable RegistryTag<Enchantment> enchantments, Range.Int levels) Creates an instance of aEnchantmentListPredicaterecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns 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.levels()Returns the value of thelevelsrecord component.booleantest(EnchantmentList enchantmentList) final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
-
-
Constructor Details
-
EnchantmentListPredicate
public EnchantmentListPredicate(@Nullable @Nullable RegistryTag<Enchantment> enchantments, @Nullable Range.Int levels) Creates an instance of aEnchantmentListPredicaterecord class.- Parameters:
enchantments- the value for theenchantmentsrecord componentlevels- the value for thelevelsrecord component
-
-
Method Details
-
test
- Specified by:
testin interfacePredicate<EnchantmentList>
-
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
-
levels
-