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.
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.GenericRecipesManager;
Methods
Link to methods
Name: addJsonRecipe
Add a new recipe based on the given recipe in a valid DataPack JSON format.
Unlike the addJSONRecipe method in IRecipeManager<T> you must set the type of the recipe within the JSON yourself.
ZenScript Copy// GenericRecipesManager.addJsonRecipe(name as string, data as MapData)
recipes.addJsonRecipe("recipe_name", {
type: "minecraft:smoking",
ingredient: <item:minecraft:gold_ore>,
result: <item:minecraft:cooked_porkchop>,
experience: 0.35 as float,
cookingtime: 100
});
Parameter | Type | Description |
---|---|---|
Parameter name | Type string | Description The recipe's resource path |
Parameter data | Type MapData | Description 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<RecipeHolder<Recipe<RecipeInput>>>
ZenScript Copy// GenericRecipesManager.getAllRecipes() as stdlib.List<RecipeHolder<Recipe<RecipeInput>>>
recipes.getAllRecipes();
Name: getRecipeByName
Return Type: RecipeHolder<Recipe<RecipeInput>>
ZenScript CopyGenericRecipesManager.getRecipeByName(name as string) as RecipeHolder<Recipe<RecipeInput>>
Parameter | Type |
---|---|
Parameter name | Type string |
Name: getRecipeMap
Returns a map of all known recipes.
Returns: A Map of recipe name to recipe of all known recipes.
Return Type: RecipeHolder<Recipe<RecipeInput>>[ResourceLocation]
ZenScript Copy// GenericRecipesManager.getRecipeMap() as RecipeHolder<Recipe<RecipeInput>>[ResourceLocation]
recipes.getRecipeMap();
Name: getRecipesByOutput
Return Type: stdlib.List<RecipeHolder<Recipe<RecipeInput>>>
ZenScript CopyGenericRecipesManager.getRecipesByOutput(output as IIngredient) as stdlib.List<RecipeHolder<Recipe<RecipeInput>>>
Parameter | Type |
---|---|
Parameter output | Type IIngredient |
Name: getRecipesMatching
Return Type: stdlib.List<RecipeHolder<Recipe<RecipeInput>>>
ZenScript CopyGenericRecipesManager.getRecipesMatching(predicate as Predicate<RecipeHolder<Recipe<RecipeInput>>>) as stdlib.List<RecipeHolder<Recipe<RecipeInput>>>
Parameter | Type |
---|---|
Parameter predicate | Type Predicate<RecipeHolder<Recipe<RecipeInput>>> |
Name: remove
Removes recipes by output
ZenScript Copy// GenericRecipesManager.remove(output as IIngredient)
recipes.remove(<item:minecraft:iron_ingot>);
Parameter | Type | Description |
---|---|---|
Parameter output | Type IIngredient | Description The recipe result |
Name: removeAll
Removes all recipes from all managers.
ZenScript Copy// GenericRecipesManager.removeAll()
recipes.removeAll();
Name: removeByInput
Removes all recipes where the input contains the given IItemStack.
ZenScript Copy// GenericRecipesManager.removeByInput(input as IItemStack)
recipes.removeByInput(<item:minecraft:iron_ingot>);
Parameter | Type | Description |
---|---|---|
Parameter input | Type IItemStack | Description The input IItemStack. |
Name: removeByModid
Removes all recipes from the provided mod. Chooses the recipes based on their full recipe name, not based on output item!
ZenScript Copy// GenericRecipesManager.removeByModid(modId as string)
recipes.removeByModid("crafttweaker");
Parameter | Type | Description |
---|---|---|
Parameter modId | Type string | Description 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!
ZenScript Copy// GenericRecipesManager.removeByModid(modId as string, exclude as Predicate<string>)
recipes.removeByModid("minecraft", (recipeName as string) => recipeName == "white_bed");
Parameter | Type | Description |
---|---|---|
Parameter modId | Type string | Description The mod's modid |
Parameter exclude | Type Predicate<string> | Description Function that returns true if the recipe should remain in the registry. |
Name: removeByName
Remove recipes based on Registry names
ZenScript CopyGenericRecipesManager.removeByName(names as string[])
Parameter | Type | Description |
---|---|---|
Parameter names | Type string[] | Description registry names of recipes to remove |
Name: removeByRegex
Remove recipe based on regex
ZenScript Copy// GenericRecipesManager.removeByRegex(regex as string)
recipes.removeByRegex("\\d_\\d");
Parameter | Type | Description |
---|---|---|
Parameter regex | Type string | Description regex to match against |
Name: removeMatching
Removes all recipes that match the given predicate
ZenScript Copy// GenericRecipesManager.removeMatching(predicate as Predicate<RecipeHolder<Recipe<RecipeInput>>>)
recipes.removeMatching((holder) => "wool" in holder.id.path);
Parameter | Type | Description |
---|---|---|
Parameter predicate | Type Predicate<RecipeHolder<Recipe<RecipeInput>>> | Description a predicate of RecipeHolder<Recipe<Container>> to test recipes against. |
Properties
Link to properties
Name | Type | Has Getter | Has Setter | Description |
---|---|---|---|---|
Name allManagers | Type stdlib.List<IRecipeManager> | Has Getter true | Has Setter false | Description 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. |
Name allRecipes | Type stdlib.List<RecipeHolder<Recipe<RecipeInput>>> | Has Getter true | Has Setter false | Description ​ |
Name recipeMap | Type RecipeHolder<Recipe<RecipeInput>>[ResourceLocation] | Has Getter true | Has Setter false | Description Returns a map of all known recipes. |