GenericRecipesManager

Link to genericrecipesmanager

This recipe manager allows you to perform removal actions over all recipe managers. You can access this manager by using the recipes global keyword.

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
Copy
import crafttweaker.api.GenericRecipesManager;

Name: addJSONRecipe

Add a new recipe based on the given recipe in a valid DataPack JSON format.

Unlike the addJSONRecipe method in IRecipeManager you must set the type of the recipe within the JSON yourself.

Return Type: void

ZenScript
Copy
// GenericRecipesManager.addJSONRecipe(name as string, data as IData) as void

recipes.addJSONRecipe("recipe_name", {
 type: "minecraft:smoking",
 ingredient: <item:minecraft:gold_ore>,
 result: <item:minecraft:cooked_porkchop>,
 experience: 0.35 as float,
 cookingtime: 100
 });
参数类型描述
参数
name(名称)
类型
string
描述
The recipe's resource path
参数
data
类型
IData #数据
描述
The recipe in JSON format

Name: getAllManagers

Returns a list of all known recipe managers. This includes managers added by mod integrations as well as wrapper managers added to provide simple support.

Return Type: stdlib.List<IRecipeManager>

ZenScript
Copy
// GenericRecipesManager.getAllManagers() as stdlib.List<IRecipeManager>

recipes.getAllManagers();

Name: getAllRecipes

Return Type: stdlib.List<WrapperRecipe>

ZenScript
Copy
// GenericRecipesManager.getAllRecipes() as stdlib.List<WrapperRecipe>

recipes.getAllRecipes();

Name: getRecipeByName

Return Type: WrapperRecipe

ZenScript
Copy
GenericRecipesManager.getRecipeByName(name as string) as WrapperRecipe
参数类型描述
参数
name(名称)
类型
string
描述
No Description Provided

Name: getRecipeMap

Returns a map of all known recipes.

Returns: A Map of recipe name to recipe of all known recipes.
Return Type: WrapperRecipe[MCResourceLocation]

ZenScript
Copy
// GenericRecipesManager.getRecipeMap() as WrapperRecipe[MCResourceLocation]

recipes.getRecipeMap();

Link to getRecipesByOutput

Name: getRecipesByOutput

Return Type: stdlib.List<WrapperRecipe>

ZenScript
Copy
GenericRecipesManager.getRecipesByOutput(output as IIngredient) as stdlib.List<WrapperRecipe>
参数类型描述
参数
output(输出)
类型
材料(IIngredient)
描述
No Description Provided

Name: removeAll

Removes all recipes from all managers.

Return Type: void

ZenScript
Copy
// GenericRecipesManager.removeAll() as void

recipes.removeAll();

Name: removeByModid

Removes all recipes from the provided mod. Chooses the recipes based on their full recipe name, not based on output item!

Return Type: void

ZenScript
Copy
// GenericRecipesManager.removeByModid(modId as string) as void

recipes.removeByModid("crafttweaker");
参数类型描述
参数
modId
类型
string
描述
The mod's modId

Name: removeByModid

Removes all recipes from the provided mod. Allows a function to exclude certain recipe names from being removed. In the example below, only the recipe for the white bed would remain. Since the recipe's namespace is already fixed based on the modId argument, the recipe filter will only check the resource path!

Return Type: void

ZenScript
Copy
// GenericRecipesManager.removeByModid(modId as string, exclude as RecipeFilter) as void

recipes.removeByModid("minecraft", (recipeName as string) => recipeName == "white_bed");
参数类型描述
参数
modId
类型
string
描述
The mod's modid
参数
不包含
类型
RecipeFilter
描述
Function that returns true if the recipe should remain in the registry.

Name: removeByName

Removes all recipes with this name.

Return Type: void

ZenScript
Copy
GenericRecipesManager.removeByName(name as string) as void
参数类型描述
参数
name(名称)
类型
string
描述
The recipe name to remove

Name: removeByRegex

Remove recipe based on regex

Return Type: void

ZenScript
Copy
// GenericRecipesManager.removeByRegex(regex as string) as void

recipes.removeByRegex("\\d_\\d");
参数类型描述
参数
regex
类型
string
描述
regex to match against

Name: removeRecipe

Removes recipes by output

Return Type: void

ZenScript
Copy
// GenericRecipesManager.removeRecipe(output as IIngredient) as void

recipes.removeRecipe(<item:minecraft:iron_ingot>);
参数类型描述
参数
output(输出)
类型
材料(IIngredient)
描述
The recipe result

Link to removeRecipeByInput

Name: removeRecipeByInput

Removes all recipes who's input contains the given IItemStack.

Return Type: void

ZenScript
Copy
// GenericRecipesManager.removeRecipeByInput(input as IItemStack) as void

recipes.removeRecipeByInput(<item:minecraft:iron_ingot>);
参数类型描述
参数
input(输入)
类型
IItemstack
描述
The input IItemStack.
名称类型可获得可设置描述
名称
allManagers
类型
stdlib.List<IRecipeManager>
可获得
true
可设置
false
描述
Returns a list of all known recipe managers.
This includes managers added by mod integrations as well as wrapper managers added to provide simple support.
名称
allRecipes
类型
stdlib.List<WrapperRecipe>
可获得
true
可设置
false
描述
No Description Provided
名称
recipeMap
类型
WrapperRecipe[MCResourceLocation]
可获得
true
可设置
false
描述
Returns a map of all known recipes.