Record Class ItemPredicate
java.lang.Object
java.lang.Record
net.minecraft.advancements.critereon.ItemPredicate
public record ItemPredicate(Optional<TagKey<Item>> tag, Optional<HolderSet<Item>> items, MinMaxBounds.Ints count, MinMaxBounds.Ints durability, List<EnchantmentPredicate> enchantments, List<EnchantmentPredicate> storedEnchantments, Optional<Holder<Potion>> potion, Optional<NbtPredicate> nbt)
extends Record
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<ItemPredicate>private final MinMaxBounds.IntsThe field for thecountrecord component.private final MinMaxBounds.IntsThe field for thedurabilityrecord component.private final List<EnchantmentPredicate>The field for theenchantmentsrecord component.The field for theitemsrecord component.private final Optional<NbtPredicate>The field for thenbtrecord component.The field for thepotionrecord component.private final List<EnchantmentPredicate>The field for thestoredEnchantmentsrecord component.The field for thetagrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionItemPredicate(Optional<TagKey<Item>> tag, Optional<HolderSet<Item>> items, MinMaxBounds.Ints count, MinMaxBounds.Ints durability, List<EnchantmentPredicate> enchantments, List<EnchantmentPredicate> storedEnchantments, Optional<Holder<Potion>> potion, Optional<NbtPredicate> nbt) Creates an instance of aItemPredicaterecord class. -
Method Summary
Modifier and TypeMethodDescriptioncount()Returns the value of thecountrecord component.Returns the value of thedurabilityrecord component.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.items()Returns the value of theitemsrecord component.booleannbt()Returns the value of thenbtrecord component.potion()Returns the value of thepotionrecord component.Returns the value of thestoredEnchantmentsrecord component.tag()Returns the value of thetagrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
tag
The field for thetagrecord component. -
items
The field for theitemsrecord component. -
count
The field for thecountrecord component. -
durability
The field for thedurabilityrecord component. -
enchantments
The field for theenchantmentsrecord component. -
storedEnchantments
The field for thestoredEnchantmentsrecord component. -
potion
The field for thepotionrecord component. -
nbt
The field for thenbtrecord component. -
ITEMS_CODEC
-
CODEC
-
-
Constructor Details
-
ItemPredicate
public ItemPredicate(Optional<TagKey<Item>> tag, Optional<HolderSet<Item>> items, MinMaxBounds.Ints count, MinMaxBounds.Ints durability, List<EnchantmentPredicate> enchantments, List<EnchantmentPredicate> storedEnchantments, Optional<Holder<Potion>> potion, Optional<NbtPredicate> nbt) Creates an instance of aItemPredicaterecord class.- Parameters:
tag- the value for thetagrecord componentitems- the value for theitemsrecord componentcount- the value for thecountrecord componentdurability- the value for thedurabilityrecord componentenchantments- the value for theenchantmentsrecord componentstoredEnchantments- the value for thestoredEnchantmentsrecord componentpotion- the value for thepotionrecord componentnbt- the value for thenbtrecord component
-
-
Method Details
-
matches
-
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). -
tag
Returns the value of thetagrecord component.- Returns:
- the value of the
tagrecord component
-
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
-
durability
Returns the value of thedurabilityrecord component.- Returns:
- the value of the
durabilityrecord component
-
enchantments
Returns the value of theenchantmentsrecord component.- Returns:
- the value of the
enchantmentsrecord component
-
storedEnchantments
Returns the value of thestoredEnchantmentsrecord component.- Returns:
- the value of the
storedEnchantmentsrecord component
-
potion
Returns the value of thepotionrecord component.- Returns:
- the value of the
potionrecord component
-
nbt
Returns the value of thenbtrecord component.- Returns:
- the value of the
nbtrecord component
-