NameFilteringRule
Link to namefilteringrule
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<C>#getId(), at the cost of some efficiency.
导入类
Link to 导入类
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.NameFilteringRule;
已实现的接口
Link to 已实现的接口
NameFilteringRule implements the following interfaces. That means all methods defined in these interfaces are also available in NameFilteringRule
Static Methods
Link to static-methods
Name: anyOf
Creates a rule that filters only recipes with the specific given names.
The names are matched exactly, in both namespace and path.
Returns: A rule carrying out what has been specified.
Return Type: NameFilteringRule
ZenScript CopyNameFilteringRule.anyOf(exactNames as string[]) as NameFilteringRule
参数 | 类型 | 描述 |
---|---|---|
参数 exactNames | 类型 string[] | 描述 The exact names to look for. |
Name: 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.
Returns: A rule carrying out exactly what has been specified.
Return Type: NameFilteringRule
ZenScript CopyNameFilteringRule.containing(contents as string) as NameFilteringRule
参数 | 类型 | 描述 |
---|---|---|
参数 contents | 类型 string | 描述 The contents to look for in the recipe's name. |
Name: regex
Creates a rule filtering recipes based on the given regular expression.
Returns: A rule carrying out what has been specified.
Return Type: NameFilteringRule
ZenScript CopyNameFilteringRule.regex(regex as string) as NameFilteringRule
参数 | 类型 | 描述 |
---|---|---|
参数 regex | 类型 string | 描述 The regular expression to use. |