ComponentFilteringRule<T : Object>
Link to componentfilteringrulet--object
Filters recipes that have the specified IRecipeComponent<T>, 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<T>. Optionally, the value of the component must match a specific value or a Predicate<T> to match, for more custom filtering. The value of the recipe component can be checked with any ITargetingStrategy.
Importing the class
Link to importing-the-class
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport crafttweaker.api.recipe.replacement.type.ComponentFilteringRule;
Implemented Interfaces
Link to implemented-interfaces
ComponentFilteringRule implements the following interfaces. That means all methods defined in these interfaces are also available in ComponentFilteringRule
Static Methods
Link to static-methods
Name: of
Creates a new rule that filters recipes that have the given IRecipeComponent<T>.
The value of the component is not checked, merely its presence.
Returns: A rule carrying out what has been specified.
Return Type: ComponentFilteringRule<T>
ZenScript CopyComponentFilteringRule.of<T : Object>(component as IRecipeComponent<T>) as ComponentFilteringRule<T>
Parameter | Type | Description |
---|---|---|
Parameter component | Type IRecipeComponent<T> | Description The component to check for. |
Parameter T | Type Object | Description The type of the object pointed to by the component. |
Name: of
Creates a new rule that filters recipes that have the given IRecipeComponent<T> 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.
Return Type: ComponentFilteringRule<T>
ZenScript CopyComponentFilteringRule.of<T : Object>(component as IRecipeComponent<T>, content as T) as ComponentFilteringRule<T>
Parameter | Type | Description |
---|---|---|
Parameter component | Type IRecipeComponent<T> | Description The component to check for. |
Parameter content | Type T | Description The oracle that represents the element to check for. |
Parameter T | Type Object | Description The type of the object pointed to by the component. |
Name: of
Creates a new rule that filters recipes that have the given IRecipeComponent<T> and whose value matches
the given Predicate<T> according to the given ITargetingStrategy.
Returns: A rule carrying out what has been specified
Return Type: ComponentFilteringRule<T>
ZenScript CopyComponentFilteringRule.of<T : Object>(component as IRecipeComponent<T>, content as Predicate<T>, checkStrategy as ITargetingStrategy) as ComponentFilteringRule<T>
Parameter | Type | Description |
---|---|---|
Parameter component | Type IRecipeComponent<T> | Description The component to check for. |
Parameter content | Type Predicate<T> | Description A Predicate<T> that determines whether an element is wanted or not. Its argument represents the object to check for. |
Parameter checkStrategy | Type ITargetingStrategy | Description The strategy that needs to be used to compare the component's value. |
Parameter T | Type Object | Description The type of object pointed to by the component. |
Name: of
Creates a new rule that filters recipes that have the given IRecipeComponent<T> and whose value matches the
given content
according to the given ITargetingStrategy.
Returns: A rule carrying out what has been specified.
Return Type: ComponentFilteringRule<T>
ZenScript CopyComponentFilteringRule.of<T : Object>(component as IRecipeComponent<T>, content as T, checkStrategy as ITargetingStrategy) as ComponentFilteringRule<T>
Parameter | Type | Description |
---|---|---|
Parameter component | Type IRecipeComponent<T> | Description The component to check for. |
Parameter content | Type T | Description The oracle that represents the element to check for. |
Parameter checkStrategy | Type ITargetingStrategy | Description The strategy that needs to be used to compare the component's value. |
Parameter T | Type Object | Description The type of the object pointed to by the component. |