Record Class ItemPredicate
java.lang.Object
java.lang.Record
net.minecraft.advancements.critereon.ItemPredicate
public record ItemPredicate(Optional<HolderSet<Item>> items, MinMaxBounds.Ints count, DataComponentPredicate components, Map<ItemSubPredicate.Type<?>,ItemSubPredicate> subPredicates)
extends Record
implements Predicate<ItemStack>
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec
<ItemPredicate> private final DataComponentPredicate
The field for thecomponents
record component.private final MinMaxBounds.Ints
The field for thecount
record component.The field for theitems
record component.private final Map
<ItemSubPredicate.Type<?>, ItemSubPredicate> The field for thesubPredicates
record component. -
Constructor Summary
ConstructorDescriptionItemPredicate
(Optional<HolderSet<Item>> items, MinMaxBounds.Ints count, DataComponentPredicate components, Map<ItemSubPredicate.Type<?>, ItemSubPredicate> subPredicates) Creates an instance of aItemPredicate
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecomponents
record component.count()
Returns the value of thecount
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.items()
Returns the value of theitems
record component.Returns the value of thesubPredicates
record component.boolean
final String
toString()
Returns a string representation of this record class.
-
Field Details
-
items
The field for theitems
record component. -
count
The field for thecount
record component. -
components
The field for thecomponents
record component. -
subPredicates
The field for thesubPredicates
record component. -
CODEC
-
-
Constructor Details
-
ItemPredicate
public ItemPredicate(Optional<HolderSet<Item>> items, MinMaxBounds.Ints count, DataComponentPredicate components, Map<ItemSubPredicate.Type<?>, ItemSubPredicate> subPredicates) Creates an instance of aItemPredicate
record class.- Parameters:
items
- the value for theitems
record componentcount
- the value for thecount
record componentcomponents
- the value for thecomponents
record componentsubPredicates
- the value for thesubPredicates
record 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 theitems
record component.- Returns:
- the value of the
items
record component
-
count
Returns the value of thecount
record component.- Returns:
- the value of the
count
record component
-
components
Returns the value of thecomponents
record component.- Returns:
- the value of the
components
record component
-
subPredicates
Returns the value of thesubPredicates
record component.- Returns:
- the value of the
subPredicates
record component
-