Class ItemHasCriterion

java.lang.Object
com.github.darksoulq.abyssallib.world.advancement.criterion.ItemHasCriterion
All Implemented Interfaces:
AdvancementCriterion

public class ItemHasCriterion extends Object implements AdvancementCriterion
An advancement criterion ensuring the player has an item matching a specified predicate in their inventory.
  • Field Details

    • CODEC

      public static final Codec<ItemHasCriterion> CODEC
      The codec used for serializing and deserializing the item has criterion.
    • TYPE

      public static final CriterionType<ItemHasCriterion> TYPE
      The registered type definition for the item has criterion.
  • Constructor Details

    • ItemHasCriterion

      public ItemHasCriterion(ItemPredicate predicate)
      Constructs a new ItemHasCriterion.
      Parameters:
      predicate - The predicate defining the required item.
  • Method Details

    • getType

      public CriterionType<?> getType()
      Description copied from interface: AdvancementCriterion
      Retrieves the type definition associated with this specific criterion instance. This is used for identifying the logic and serialization codec.
      Specified by:
      getType in interface AdvancementCriterion
      Returns:
      The CriterionType characterizing 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:
      isMet in interface AdvancementCriterion
      Parameters:
      player - The player to evaluate.
      Returns:
      True if the condition is met.