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
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<ItemPredicate>
private final MinMaxBounds.Ints
The field for thecount
record component.private final MinMaxBounds.Ints
The field for thedurability
record component.private final List<EnchantmentPredicate>
The field for theenchantments
record component.The field for theitems
record component.private final Optional<NbtPredicate>
The field for thenbt
record component.The field for thepotion
record component.private final List<EnchantmentPredicate>
The field for thestoredEnchantments
record component.The field for thetag
record component. -
Constructor Summary
ConstructorDescriptionItemPredicate
(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 aItemPredicate
record class. -
Method Summary
Modifier and TypeMethodDescriptioncount()
Returns the value of thecount
record component.Returns the value of thedurability
record component.Returns the value of theenchantments
record component.final boolean
Indicates whether some other object is "equal to" this one.static Optional<ItemPredicate>
fromJson
(com.google.gson.JsonElement p_45052_) static List<ItemPredicate>
fromJsonArray
(com.google.gson.JsonElement p_45056_) final int
hashCode()
Returns a hash code value for this object.items()
Returns the value of theitems
record component.boolean
nbt()
Returns the value of thenbt
record component.potion()
Returns the value of thepotion
record component.com.google.gson.JsonElement
static com.google.gson.JsonElement
serializeToJsonArray
(List<ItemPredicate> p_298997_) Returns the value of thestoredEnchantments
record component.tag()
Returns the value of thetag
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
tag
The field for thetag
record component. -
items
The field for theitems
record component. -
count
The field for thecount
record component. -
durability
The field for thedurability
record component. -
enchantments
The field for theenchantments
record component. -
storedEnchantments
The field for thestoredEnchantments
record component. -
potion
The field for thepotion
record component. -
nbt
The field for thenbt
record 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 aItemPredicate
record class.- Parameters:
tag
- the value for thetag
record componentitems
- the value for theitems
record componentcount
- the value for thecount
record componentdurability
- the value for thedurability
record componentenchantments
- the value for theenchantments
record componentstoredEnchantments
- the value for thestoredEnchantments
record componentpotion
- the value for thepotion
record componentnbt
- the value for thenbt
record component
-
-
Method Details
-
matches
-
fromJson
-
serializeToJson
public com.google.gson.JsonElement serializeToJson() -
serializeToJsonArray
-
fromJsonArray
-
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 thetag
record component.- Returns:
- the value of the
tag
record component
-
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
-
durability
Returns the value of thedurability
record component.- Returns:
- the value of the
durability
record component
-
enchantments
Returns the value of theenchantments
record component.- Returns:
- the value of the
enchantments
record component
-
storedEnchantments
Returns the value of thestoredEnchantments
record component.- Returns:
- the value of the
storedEnchantments
record component
-
potion
Returns the value of thepotion
record component.- Returns:
- the value of the
potion
record component
-
nbt
Returns the value of thenbt
record component.- Returns:
- the value of the
nbt
record component
-