Class ItemPredicate.Builder
java.lang.Object
com.github.darksoulq.abyssallib.world.item.ItemPredicate.Builder
- Enclosing class:
ItemPredicate
A fluent builder pattern class designed to easily construct
ItemPredicate instances.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Finalizes construction and returns the built ItemPredicate.check(Condition<ItemPredicate> condition) Adds a nested predicate condition.check(ItemPredicate predicate) Evaluates a sub-predicate against the item.checkAny(ItemPredicate... predicates) Requires the item to satisfy at least one of the provided sub-predicates.id(net.kyori.adventure.key.Key id) Mandates that the item matches a specific base Key.material(org.bukkit.Material material) Mandates that the item matches a specific vanilla material.value(Condition<DataComponent<?>> condition) Adds a value-matching condition requiring exact component equivalence.value(DataComponent<T> component) Requires an exact value match against a provided data component.valueAny(DataComponent<?>... components) Requires an exact value match against at least one of the provided components.Adds an inclusionary condition requiring the presence of specific components.with(net.kyori.adventure.key.Key identifier) Requires the strict presence of a specific component Key.withAny(Collection<net.kyori.adventure.key.Key> identifiers) Requires the presence of at least one of the provided component Keys.withAny(net.kyori.adventure.key.Key... identifiers) Requires the presence of at least one of the provided component Keys.Adds an exclusionary condition requiring the absence of specific components.without(net.kyori.adventure.key.Key identifier) Requires the strict absence of a specific component Key.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
id
Mandates that the item matches a specific base Key.- Parameters:
id- TheKeyto match.- Returns:
- This builder instance.
-
material
Mandates that the item matches a specific vanilla material.- Parameters:
material- TheMaterialto match.- Returns:
- This builder instance.
-
without
Adds an exclusionary condition requiring the absence of specific components.- Parameters:
condition- TheConditionwrapping a component Key.- Returns:
- This builder instance.
-
with
Adds an inclusionary condition requiring the presence of specific components.- Parameters:
condition- TheConditionwrapping a component Key.- Returns:
- This builder instance.
-
value
Adds a value-matching condition requiring exact component equivalence.- Parameters:
condition- TheConditionwrapping a data component instance.- Returns:
- This builder instance.
-
check
Adds a nested predicate condition.- Parameters:
condition- TheConditionwrapping a nested predicate.- Returns:
- This builder instance.
-
without
Requires the strict absence of a specific component Key.- Parameters:
identifier- TheKeyof the component that must be absent.- Returns:
- This builder instance.
-
with
Requires the strict presence of a specific component Key.- Parameters:
identifier- TheKeyof the component that must be present.- Returns:
- This builder instance.
-
value
Requires an exact value match against a provided data component.- Type Parameters:
T- The data type of the component.- Parameters:
component- TheDataComponentto match against.- Returns:
- This builder instance.
-
check
Evaluates a sub-predicate against the item.- Parameters:
predicate- The nestedItemPredicateto test.- Returns:
- This builder instance.
-
withAny
Requires the presence of at least one of the provided component Keys.- Parameters:
identifiers- The varargs array of componentKeys to check.- Returns:
- This builder instance.
-
withAny
Requires the presence of at least one of the provided component Keys.- Parameters:
identifiers- The collection of componentKeys to check.- Returns:
- This builder instance.
-
valueAny
Requires an exact value match against at least one of the provided components.- Parameters:
components- The varargs array ofDataComponentinstances to check.- Returns:
- This builder instance.
-
checkAny
Requires the item to satisfy at least one of the provided sub-predicates.- Parameters:
predicates- The varargs array of nestedItemPredicates to check.- Returns:
- This builder instance.
-
build
Finalizes construction and returns the built ItemPredicate.- Returns:
- The configured
ItemPredicateinstance.
-