Class NameFilteringRule
java.lang.Object
com.blamejared.crafttweaker.api.recipe.replacement.type.NameFilteringRule
- All Implemented Interfaces:
IFilteringRule,ITargetingFilter
Filters recipes that match a specific pattern on their name.
This acts as a less specialized version of ModsFilteringRule as it allows custom matching on the entirety
of a recipe's name as determined by Recipe.getId(), at the cost of some efficiency.
- Since:
- 10.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic NameFilteringRuleCreates a rule that filters only recipes with the specific given names.Stream<? extends net.minecraft.world.item.crafting.Recipe<?>>castFilter(Stream<? extends net.minecraft.world.item.crafting.Recipe<?>> allRecipes) Casts the filter onto the givenStreamofRecipes.static NameFilteringRulecontaining(String contents) Creates a rule filtering recipes that have the given word in their name.describe()Describes the actions of this filtering rule in a human-readable form, for log output.static NameFilteringRuleCreates a rule filtering recipes based on the given regular expression.
-
Method Details
-
anyOf
Creates a rule that filters only recipes with the specific given names.The names are matched exactly, in both namespace and path.
- Parameters:
exactNames- The exact names to look for.- Returns:
- A rule carrying out what has been specified.
- Since:
- 10.0.0
-
containing
Creates a rule filtering recipes that have the given word in their name.The word is not matched exactly and word boundaries aren't considered. This means that if a recipe is called
"minecraft:pumpkin_pie"and the rule is set up to check"pump", that recipe will pass the check instead of failing it.- Parameters:
contents- The contents to look for in the recipe's name.- Returns:
- A rule carrying out exactly what has been specified.
- Since:
- 10.0.0
-
regex
Creates a rule filtering recipes based on the given regular expression.- Parameters:
regex- The regular expression to use.- Returns:
- A rule carrying out what has been specified.
- Since:
- 10.0.0
-
castFilter
public Stream<? extends net.minecraft.world.item.crafting.Recipe<?>> castFilter(Stream<? extends net.minecraft.world.item.crafting.Recipe<?>> allRecipes) Description copied from interface:ITargetingFilterCasts the filter onto the givenStreamofRecipes.The filter can perform any operation required, which range from filtering, to simple mapping, to peeking as needed.
- Specified by:
castFilterin interfaceITargetingFilter- Parameters:
allRecipes- TheStreamthat needs to be filtered.- Returns:
- The mutated stream.
-
describe
Description copied from interface:IFilteringRuleDescribes the actions of this filtering rule in a human-readable form, for log output.- Specified by:
describein interfaceIFilteringRule- Returns:
- A human-readable description of this rule.
-