ComponentFilteringRule

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.ComponentFilteringRule;

Description

Filters recipes that have the specified IRecipeComponent, optionally with a check on its value.

In other words, to be able to be processed by the replacer, the target recipe must have the specified IRecipeComponent. Optionally, the value of the component must match a specific value or a Predicate
to match, for more custom filtering. The value of the recipe component can be checked with any ITargetingStrategy.

Implements

ComponentFilteringRule<T> implements the following interfaces:

IFilteringRule,ITargetingFilter

Members

static of<T>(component as IRecipeComponent<T>) as ComponentFilteringRule<T>
Creates a new rule that filters recipes that have the given IRecipeComponent.

The value of the component is not checked, merely its presence.

Returns: A rule carrying out what has been specified.

script.zs
// ComponentFilteringRule<T>.of<T>(component as IRecipeComponent<T>) as ComponentFilteringRule<T>;
ComponentFilteringRule<T>.of<T>(myIRecipeComponent);

Parameters:

component Type: IRecipeComponent<T> - The component to check for.

Return Type: ComponentFilteringRule<T>

static of<T>(component as IRecipeComponent<T>, content as T) as ComponentFilteringRule<T>
Creates a new rule that filters recipes that have the given IRecipeComponent and whose value matches the given content.

The strategy used is the default one, so components will be checked directly.

Returns: A rule carrying out what has been specified.

script.zs
// ComponentFilteringRule<T>.of<T>(component as IRecipeComponent<T>, content as T) as ComponentFilteringRule<T>;
ComponentFilteringRule<T>.of<T>(myIRecipeComponent, myT);

Parameters:

component Type: IRecipeComponent<T> - The component to check for.
content Type: T - The oracle that represents the element to check for.

Return Type: ComponentFilteringRule<T>

static of<T>(component as IRecipeComponent<T>, content as T, checkStrategy as ITargetingStrategy) as ComponentFilteringRule<T>
Creates a new rule that filters recipes that have the given IRecipeComponent and whose value matches the given content according to the given ITargetingStrategy.

Returns: A rule carrying out what has been specified.

script.zs
// ComponentFilteringRule<T>.of<T>(component as IRecipeComponent<T>, content as T, checkStrategy as ITargetingStrategy) as ComponentFilteringRule<T>;
ComponentFilteringRule<T>.of<T>(myIRecipeComponent, myT, myITargetingStrategy);

Parameters:

component Type: IRecipeComponent<T> - The component to check for.
content Type: T - The oracle that represents the element to check for.
checkStrategy Type: ITargetingStrategy - The strategy that needs to be used to compare the component's value.

Return Type: ComponentFilteringRule<T>

static of<T>(component as IRecipeComponent<T>, content as function(t as T) as bool, checkStrategy as ITargetingStrategy) as ComponentFilteringRule<T>
Creates a new rule that filters recipes that have the given IRecipeComponent and whose value matches the given Predicate according to the given ITargetingStrategy.

Returns: A rule carrying out what has been specified

script.zs
// ComponentFilteringRule<T>.of<T>(component as IRecipeComponent<T>, content as function(t as T) as bool, checkStrategy as ITargetingStrategy) as ComponentFilteringRule<T>;
ComponentFilteringRule<T>.of<T>(myIRecipeComponent, myPredicate, myITargetingStrategy);

Parameters:

component Type: IRecipeComponent<T> - The component to check for.
content Type: function(t as T) as bool - A Predicate that determines whether an element is wanted or not. Its argument
represents the object to check for.
checkStrategy Type: ITargetingStrategy - The strategy that needs to be used to compare the component's value.

Return Type: ComponentFilteringRule<T>