CustomFilteringRule

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.api.recipe.replacement.type.CustomFilteringRule;

Description

Filters recipes according to a custom set of rules.

Implements

CustomFilteringRule implements the following interfaces:

IFilteringRule,ITargetingFilter

Members

static of(predicate as function(t as Recipe<?>) as bool) as CustomFilteringRule
Creates a new rule filtering recipes based on the given Predicate.

The predicate gets access to the Recipe instance directly, allowing for it to check directly elements that might be required.

Returns: A rule carrying out what has been specified.

script.zs
// CustomFilteringRule.of(predicate as function(t as Recipe<?>) as bool) as CustomFilteringRule;
CustomFilteringRule.of(myPredicate);

Parameters:

predicate Type: function(t as Recipe<?>) as bool - The predicate for checking.

Return Type: CustomFilteringRule

static of(predicate as BiPredicate<IRecipeManager<?>, Recipe<?>>) as CustomFilteringRule
Creates a new rule filtering recipes based on the given BiPredicate.

The predicate's first argument represents the IRecipeManager used by the recipe, whereas the second argument is the Recipe instance directly, allowing for it to check properties that might be required or perform additional manager-specific lookups.

Returns: A rule carrying out what has been specified.

script.zs
// CustomFilteringRule.of(predicate as BiPredicate<IRecipeManager<?>, Recipe<?>>) as CustomFilteringRule;
CustomFilteringRule.of(myBiPredicate);

Parameters:

predicate Type: BiPredicate<IRecipeManager<?>, Recipe<?>> - The predicate for checking.

Return Type: CustomFilteringRule