Class ItemPredicate
java.lang.Object
com.github.darksoulq.abyssallib.world.item.ItemPredicate
- All Implemented Interfaces:
Predicate<org.bukkit.inventory.ItemStack>
A sophisticated predicate used to evaluate and filter
ItemStack instances.
This class allows for complex conditional checks against an item's identity,
the presence or absence of specific data components, exact component values,
and evaluation of nested predicates.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA fluent builder pattern class designed to easily constructItemPredicateinstances. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<ItemPredicate> The primary codec used to serialize and deserialize entireItemPredicateinstances. -
Constructor Summary
ConstructorsConstructorDescriptionItemPredicate(List<Condition<net.kyori.adventure.key.Key>> without, List<Condition<net.kyori.adventure.key.Key>> with, List<Condition<DataComponent<?>>> valued, List<Condition<ItemPredicate>> predicates, net.kyori.adventure.key.Key id) Constructs a new ItemPredicate with the specified conditional rules. -
Method Summary
Modifier and TypeMethodDescriptionstatic ItemPredicate.Builderbuilder()Creates a new fluent builder instance for constructing an ItemPredicate.booleanCompares this predicate against another object for logical equivalence.inthashCode()Generates a hash code based on the predicate's underlying conditions.booleantest(org.bukkit.inventory.ItemStack stack) Evaluates an ItemStack against all configured conditions within this predicate.
-
Field Details
-
CODEC
The primary codec used to serialize and deserialize entireItemPredicateinstances. Supports resolving registered predicates by their String ID or parsing full nested objects.
-
-
Constructor Details
-
ItemPredicate
public ItemPredicate(List<Condition<net.kyori.adventure.key.Key>> without, List<Condition<net.kyori.adventure.key.Key>> with, List<Condition<DataComponent<?>>> valued, List<Condition<ItemPredicate>> predicates, net.kyori.adventure.key.Key id) Constructs a new ItemPredicate with the specified conditional rules.- Parameters:
without- The list of exclusionary component conditions.with- The list of inclusionary component conditions.valued- The list of specific value-matching component conditions.predicates- The list of nested predicate conditions.id- The base item Key that must match (nullable for any item).
-
-
Method Details
-
builder
Creates a new fluent builder instance for constructing an ItemPredicate.- Returns:
- A new
ItemPredicate.Builderinstance.
-
equals
-
hashCode
-
test
public boolean test(org.bukkit.inventory.ItemStack stack) Evaluates an ItemStack against all configured conditions within this predicate.
-