Class ItemHasCriterion
java.lang.Object
com.github.darksoulq.abyssallib.world.advancement.criterion.ItemHasCriterion
- All Implemented Interfaces:
AdvancementCriterion
An advancement criterion ensuring the player has an item matching a specified predicate in their inventory.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<ItemHasCriterion> The codec used for serializing and deserializing the item has criterion.static final CriterionType<ItemHasCriterion> The registered type definition for the item has criterion. -
Constructor Summary
ConstructorsConstructorDescriptionItemHasCriterion(ItemPredicate predicate) Constructs a new ItemHasCriterion. -
Method Summary
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AdvancementCriterion
isMet
-
Field Details
-
CODEC
The codec used for serializing and deserializing the item has criterion. -
TYPE
The registered type definition for the item has criterion.
-
-
Constructor Details
-
ItemHasCriterion
Constructs a new ItemHasCriterion.- Parameters:
predicate- The predicate defining the required item.
-
-
Method Details
-
getType
Description copied from interface:AdvancementCriterionRetrieves the type definition associated with this specific criterion instance. This is used for identifying the logic and serialization codec.- Specified by:
getTypein interfaceAdvancementCriterion- Returns:
- The
CriterionTypecharacterizing this instance.
-
isMet
public boolean isMet(org.bukkit.entity.Player player) Checks if the player's inventory contains at least one item matching the predicate.- Specified by:
isMetin interfaceAdvancementCriterion- Parameters:
player- The player to evaluate.- Returns:
- True if the condition is met.
-