RecipeManagerWrapper

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.

script.zs
import crafttweaker.api.recipe.RecipeManagerWrapper;

Implements

RecipeManagerWrapper implements the following interfaces:

IRecipeManager<Recipe<?>>,CommandStringDisplayable

Undocumented Interfaces

Iterable<RecipeHolderRecipeHolder<Recipe>>

Members

addJsonRecipe(name as string, mapData as MapData)
Adds a recipe based on a provided IData. The provided IData should represent a DataPack json, this effectively allows you to register recipes for any DataPack supporting RecipeType systems.
script.zs
// RecipeManagerWrapper.addJsonRecipe(name as string, mapData as MapData);
myRecipeManagerWrapper.addJsonRecipe("recipe_name", {
ingredient: <item:minecraft:gold_ore>,
result: <item:minecraft:cooked_porkchop>.registryName,
experience: 0.35 as float,
cookingtime:100
});

Parameters:

name Type: string - name of the recipe
mapData Type: MapData - data representing the json file
Getter
script.zs
// RecipeManagerWrapper.allRecipes as List<RecipeHolder<Recipe>>
myRecipeManagerWrapper.allRecipes

Return Type: List<RecipeHolderRecipeHolder<Recipe>>

allRecipes() as List<RecipeHolder<Recipe>>
script.zs
// RecipeManagerWrapper.allRecipes() as List<RecipeHolder<Recipe>>;
myRecipeManagerWrapper.allRecipes();

Return Type: List<RecipeHolderRecipeHolder<Recipe>>

Getter
Returns the BEP to get this thingy
script.zs
// RecipeManagerWrapper.commandString as string
myRecipeManagerWrapper.commandString

Return Type: string

commandString() as string
Returns the BEP to get this thingy
script.zs
// RecipeManagerWrapper.commandString() as string;
myRecipeManagerWrapper.commandString();

Return Type: string

getRecipeByName(name as string) as RecipeHolder<Recipe>
script.zs
// RecipeManagerWrapper.getRecipeByName(name as string) as RecipeHolder<Recipe>;
myRecipeManagerWrapper.getRecipeByName(myString);

Parameters:

name Type: string

Return Type: RecipeHolderRecipeHolder<Recipe>

getRecipesByOutput(output as IIngredient) as List<RecipeHolder<Recipe>>
script.zs
// RecipeManagerWrapper.getRecipesByOutput(output as IIngredient) as List<RecipeHolder<Recipe>>;
myRecipeManagerWrapper.getRecipesByOutput(myIIngredient);

Parameters:

output Type: IIngredient

Return Type: List<RecipeHolderRecipeHolder<Recipe>>

getRecipesMatching(predicate as function(t as RecipeHolder<Recipe>) as bool) as List<RecipeHolder<Recipe>>
script.zs
// RecipeManagerWrapper.getRecipesMatching(predicate as function(t as RecipeHolder<Recipe>) as bool) as List<RecipeHolder<Recipe>>;
myRecipeManagerWrapper.getRecipesMatching(myPredicate);

Parameters:

predicate Type: function(t as RecipeHolderRecipeHolder<Recipe>) as bool

Return Type: List<RecipeHolderRecipeHolder<Recipe>>

Getter
Returns a map of all known recipes.
script.zs
// RecipeManagerWrapper.recipeMap as RecipeHolder<Recipe>[ResourceLocation]
myRecipeManagerWrapper.recipeMap

Return Type: RecipeHolderRecipeHolder<Recipe>[ResourceLocation]

recipeMap() as RecipeHolder<Recipe>[ResourceLocation]
Returns a map of all known recipes.

Returns: A Map of recipe name to recipe of all known recipes.

script.zs
// RecipeManagerWrapper.recipeMap() as RecipeHolder<Recipe>[ResourceLocation];
myRecipeManagerWrapper.recipeMap();

Return Type: RecipeHolderRecipeHolder<Recipe>[ResourceLocation]

remove(output as IIngredient)
Remove a recipe based on it's output.
script.zs
// RecipeManagerWrapper.remove(output as IIngredient);
myRecipeManagerWrapper.remove(<tag:items:minecraft:wool>);

Parameters:

output Type: IIngredient - output of the recipe
removeAll()
Remove all recipes in this registry
script.zs
// RecipeManagerWrapper.removeAll();
myRecipeManagerWrapper.removeAll();
removeByInput(input as IItemStack)
Removes all recipes where the input contains the given IItemStack.
script.zs
// RecipeManagerWrapper.removeByInput(input as IItemStack);
myRecipeManagerWrapper.removeByInput(<item:minecraft:iron_ingot>);

Parameters:

input Type: IItemStack - The input IItemStack.
removeByModid(modid as string, exclude as function(t as string) as bool = (name as string) as bool => false)
Remove recipe based on Registry name modid
script.zs
// RecipeManagerWrapper.removeByModid(modid as string, exclude as function(t as string) as bool = (name as string) as bool => false);
myRecipeManagerWrapper.removeByModid("minecraft", myPredicate);

Parameters:

modid Type: string - modid of the recipes to remove
exclude (optional) Type: function(t as string) as bool

Default Value: (name as string) as bool => false

removeByName(names as string[])
Remove recipes based on Registry names
script.zs
// RecipeManagerWrapper.removeByName(names as string[]);
myRecipeManagerWrapper.removeByName(myString[]);

Parameters:

names Type: string[] - registry names of recipes to remove
removeByRegex(regex as string, exclude as function(t as string) as bool = (name as string) as bool => false)
Remove recipe based on regex with an added exclusion check, so you can remove the whole mod besides a few specified.
script.zs
// RecipeManagerWrapper.removeByRegex(regex as string, exclude as function(t as string) as bool = (name as string) as bool => false);
myRecipeManagerWrapper.removeByRegex("\\d_\\d", (name as string) => {return name == "orange_wool";});

Parameters:

regex Type: string - regex to match against
exclude (optional) Type: function(t as string) as bool

Default Value: (name as string) as bool => false

removeMatching(predicate as function(t as RecipeHolder<Recipe>) as bool)
Removes all recipes that match the given predicate
script.zs
// RecipeManagerWrapper.removeMatching(predicate as function(t as RecipeHolder<Recipe>) as bool);
myRecipeManagerWrapper.removeMatching((holder) => "wool" in holder.id.path);

Parameters:

predicate Type: function(t as RecipeHolderRecipeHolder<Recipe>) as bool - a predicate of RecipeHolder<T> to test recipes against.