Interface CRecipePredicate
-
- All Implemented Interfaces:
public interface CRecipePredicateThis interface is a SAM (Single Abstract Method Interface) and only has the function (CRecipePredicate.test) that is executed during recipe determination.
Refer to the documentation of CRecipePredicate.Context for the provided context.
- Since:
5.0.17
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classCRecipePredicate.ContextContext for CRecipePredicate
public classCRecipePredicate.Companion
-
Method Summary
Modifier and Type Method Description abstract Booleantest(CRecipePredicate.Context ctx)Inspection method. Stringname()Returns a label identifying this predicate in diagnostic logs. -
-
Method Detail
-
test
abstract Boolean test(CRecipePredicate.Context ctx)
Inspection method. If Context.asyncContext is non-null, periodically check AsyncContext.isInterrupted and return early when true to support cooperative cancellation.
When Context.isAsync returns
true, this method is invoked off the main thread. Avoid calling Bukkit API that requires the main thread directly; use a scheduler (e.g. FoliaLib) if main-thread access is needed.- Parameters:
ctx- Context of inspection- Returns:
Boolean Result of inspection
- Since:
5.0.17
-
name
String name()
Returns a label identifying this predicate in diagnostic logs.
A lambda carries no identity of its own, so the default is ANONYMOUS and an io.github.sakaki_aruka.customcrafter.debug.Explainer falls back to reporting the predicate's index within CRecipe.predicates. Override it, or wrap the lambda with CRecipePredicates.named, to get a readable name instead.
Combinators in CRecipePredicates derive their name from the predicates they combine, so a composed predicate reports its structure without any extra work.
-
-
-
-