GenericRecipesManager
Importing the class
If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.
import crafttweaker.api.GenericRecipesManager;
Description
This recipe manager allows you to perform removal actions over all recipe managers. You can access this manager by using therecipes
global keyword. Implements
Undocumented Interfaces
Comparable<Enum>
Enum Constants
GenericRecipesManager is an enum with 1 constant. It is accessible like so:
GenericRecipesManager.INSTANCE
Members
addJsonRecipe(name as string, data as MapData)
Add a new recipe based on the given recipe in a valid DataPack JSON format.
Unlike the addJSONRecipe method inscript.zs
Unlike the addJSONRecipe method in
IRecipeManager
you **must** set the type of the recipe within the JSON yourself.GenericRecipesManager.INSTANCE.addJsonRecipe("recipe_name", {type: "minecraft:smoking",ingredient: <item:minecraft:gold_ore>,result: <item:minecraft:cooked_porkchop>,experience: 0.35 as float,cookingtime: 100});
Getter
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.script.zs
GenericRecipesManager.INSTANCE.allManagers
Return Type:
List<IRecipeManager<?>>
allManagers() as List<IRecipeManager<?>>
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.script.zs
GenericRecipesManager.INSTANCE.allManagers();
Return Type:
List<IRecipeManager<?>>
Getter
allRecipes() as List<Recipe<?>>
getRecipesByOutput(output as IIngredient) as List<Recipe<?>>
GenericRecipesManager.INSTANCE.getRecipesByOutput(myIIngredient);
Parameters:
output: IIngredient
Type: IIngredient
Return Type:
List<Recipe<?>>
Getter
Returns a map of all known recipes.script.zs
GenericRecipesManager.INSTANCE.recipeMap
Return Type:
Recipe<?>[ResourceLocation]
recipeMap() as Recipe<?>[ResourceLocation]
Returns a map of all known recipes.script.zs
Returns: A Map of recipe name to recipe of all known recipes.
GenericRecipesManager.INSTANCE.recipeMap();
Return Type:
Recipe<?>[ResourceLocation]
remove(output as IIngredient)
Removes recipes by outputscript.zs
GenericRecipesManager.INSTANCE.remove(<item:minecraft:iron_ingot>);
Parameters:
removeAll()
Removes all recipes from all managers.script.zs
// GenericRecipesManager.removeAll();GenericRecipesManager.INSTANCE.removeAll();
removeByModid(modId as string)
Removes all recipes from the provided mod. Chooses the recipes based on their full recipe name, not based on output item!script.zs
// GenericRecipesManager.removeByModid(modId as string);GenericRecipesManager.INSTANCE.removeByModid("crafttweaker");
Parameters:
modId: string
Type: string
- The mod's modId removeByModid(modId as string, exclude as function(t as string) as bool)
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!script.zs
// GenericRecipesManager.removeByModid(modId as string, exclude as function(t as string) as bool);GenericRecipesManager.INSTANCE.removeByModid("minecraft", (recipeName as string) => recipeName == "white_bed");
Parameters:
modId: string
Type: string
- The mod's modid exclude: function(t as string) as bool
Type: function(t as string) as bool
- Function that returns true
if the recipe should remain in the registry. removeByName(names as string[])
Remove recipes based on Registry namesscript.zs
// GenericRecipesManager.removeByName(names as string[]);GenericRecipesManager.INSTANCE.removeByName(myString[]);
Parameters:
names: string[]
Type: string[]
- registry names of recipes to remove removeByRegex(regex as string)
Remove recipe based on regexscript.zs
// GenericRecipesManager.removeByRegex(regex as string);GenericRecipesManager.INSTANCE.removeByRegex("\\d_\\d");
Parameters:
regex: string
Type: string
- regex to match against removeRecipe(output as IIngredient)
Removes recipes by outputscript.zs
GenericRecipesManager.INSTANCE.removeRecipe(<item:minecraft:iron_ingot>);
Parameters: