Record Class ItemPredicate
java.lang.Object
java.lang.Record
net.minecraft.advancements.critereon.ItemPredicate
public record ItemPredicate(Optional<HolderSet<Item>> items, MinMaxBounds.Ints count, DataComponentMatchers components)
extends Record
implements Predicate<ItemStack>
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<ItemPredicate> private final DataComponentMatchersThe field for thecomponentsrecord component.private final MinMaxBounds.IntsThe field for thecountrecord component.The field for theitemsrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionItemPredicate(Optional<HolderSet<Item>> items, MinMaxBounds.Ints count, DataComponentMatchers components) Creates an instance of aItemPredicaterecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecomponentsrecord component.count()Returns the value of thecountrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.items()Returns the value of theitemsrecord component.booleanfinal StringtoString()Returns a string representation of this record class.
-
Field Details
-
items
The field for theitemsrecord component. -
count
The field for thecountrecord component. -
components
The field for thecomponentsrecord component. -
CODEC
-
-
Constructor Details
-
ItemPredicate
public ItemPredicate(Optional<HolderSet<Item>> items, MinMaxBounds.Ints count, DataComponentMatchers components) Creates an instance of aItemPredicaterecord class.- Parameters:
items- the value for theitemsrecord componentcount- the value for thecountrecord componentcomponents- the value for thecomponentsrecord component
-
-
Method Details
-
test
-
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). -
items
Returns the value of theitemsrecord component.- Returns:
- the value of the
itemsrecord component
-
count
Returns the value of thecountrecord component.- Returns:
- the value of the
countrecord component
-
components
Returns the value of thecomponentsrecord component.- Returns:
- the value of the
componentsrecord component
-