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.
import crafttweaker.api.recipe.replacement.type.ComponentFilteringRule;
Description
Filters recipes that have the specifiedIRecipeComponent
, 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
IRecipeComponent
.The value of the component is not checked, merely its presence.
Returns: A rule carrying out what has been specified.
ComponentFilteringRule<T>.of<T>(myIRecipeComponent);
Parameters:
Return Type:
ComponentFilteringRule<T>
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.
// ComponentFilteringRule<T>.of<T>(component as IRecipeComponent<T>, content as T) as ComponentFilteringRule<T>;ComponentFilteringRule<T>.of<T>(myIRecipeComponent, myT);
Parameters:
content: T
Type: T
- The oracle that represents the element to check for.
Return Type:
ComponentFilteringRule<T>
IRecipeComponent
and whose value matches the given content
according to the given ITargetingStrategy
.Returns: A rule carrying out what has been specified.
// 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:
content: T
Type: T
- The oracle that represents the element to check for. checkStrategy: ITargetingStrategy
Type: ITargetingStrategy
- The strategy that needs to be used to compare the component's value.
Return Type:
ComponentFilteringRule<T>
IRecipeComponent
and whose value matches the given Predicate according to the given ITargetingStrategy
.Returns: A rule carrying out what has been specified
// 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:
content: function(t as T) as bool
Type: function(t as T) as bool
- A Predicate that determines whether an element is wanted or not. Its argumentrepresents the object to check for.
checkStrategy: ITargetingStrategy
Type: ITargetingStrategy
- The strategy that needs to be used to compare the component's value.
Return Type:
ComponentFilteringRule<T>