SmithingRecipeManager

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.SmithingRecipeManager;

Description

Implements

SmithingRecipeManager implements the following interfaces:

IRecipeManager<SmithingRecipe>,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
// SmithingRecipeManager.addJsonRecipe(name as string, mapData as MapData);
mySmithingRecipeManager.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
addTransformRecipe(recipeName as string, result as IItemStack, template as IIngredient, base as IIngredient, addition as IIngredient)
Adds a new transform recipe to the smithing table.
script.zs
// SmithingRecipeManager.addTransformRecipe(recipeName as string, result as IItemStack, template as IIngredient, base as IIngredient, addition as IIngredient);
mySmithingRecipeManager.addTransformRecipe("recipe_name", <item:minecraft:golden_apple>, myIIngredient, <item:minecraft:apple>, <tag:items:forge:ingots/gold>);

Parameters:

recipeName Type: string - Name of the recipe.
result Type: IItemStack - The item created by the recipe.
template Type: IIngredient - The template to use.
base Type: IIngredient - The initial ingredient for the recipe.
addition Type: IIngredient - The item added to the base item.
addTrimRecipe(recipeName as string, template as IIngredient, base as IIngredient, addition as IIngredient)
Adds a new trim recipe to the smithing table.
script.zs
// SmithingRecipeManager.addTrimRecipe(recipeName as string, template as IIngredient, base as IIngredient, addition as IIngredient);
mySmithingRecipeManager.addTrimRecipe("recipe_name", myIIngredient, <item:minecraft:apple>, <tag:items:forge:ingots/gold>);

Parameters:

recipeName Type: string - Name of the recipe.
template Type: IIngredient - The template to use.
base Type: IIngredient - The initial ingredient for the recipe.
addition Type: IIngredient - The item added to the base item.
Getter
script.zs
// SmithingRecipeManager.allRecipes as List<RecipeHolder<Recipe>>
mySmithingRecipeManager.allRecipes

Return Type: List<RecipeHolderRecipeHolder<Recipe>>

allRecipes() as List<RecipeHolder<Recipe>>
script.zs
// SmithingRecipeManager.allRecipes() as List<RecipeHolder<Recipe>>;
mySmithingRecipeManager.allRecipes();

Return Type: List<RecipeHolderRecipeHolder<Recipe>>

Getter
Returns the BEP to get this thingy
script.zs
// SmithingRecipeManager.commandString as string
mySmithingRecipeManager.commandString

Return Type: string

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

Return Type: string

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

Parameters:

name Type: string

Return Type: RecipeHolderRecipeHolder<Recipe>

getRecipesByOutput(output as IIngredient) as List<RecipeHolder<Recipe>>
script.zs
// SmithingRecipeManager.getRecipesByOutput(output as IIngredient) as List<RecipeHolder<Recipe>>;
mySmithingRecipeManager.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
// SmithingRecipeManager.getRecipesMatching(predicate as function(t as RecipeHolder<Recipe>) as bool) as List<RecipeHolder<Recipe>>;
mySmithingRecipeManager.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
// SmithingRecipeManager.recipeMap as RecipeHolder<Recipe>[ResourceLocation]
mySmithingRecipeManager.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
// SmithingRecipeManager.recipeMap() as RecipeHolder<Recipe>[ResourceLocation];
mySmithingRecipeManager.recipeMap();

Return Type: RecipeHolderRecipeHolder<Recipe>[ResourceLocation]

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

Parameters:

output Type: IIngredient - output of the recipe
removeAll()
Remove all recipes in this registry
script.zs
// SmithingRecipeManager.removeAll();
mySmithingRecipeManager.removeAll();
removeByInput(input as IItemStack)
Removes all recipes where the input contains the given IItemStack.
script.zs
// SmithingRecipeManager.removeByInput(input as IItemStack);
mySmithingRecipeManager.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
// SmithingRecipeManager.removeByModid(modid as string, exclude as function(t as string) as bool = (name as string) as bool => false);
mySmithingRecipeManager.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
// SmithingRecipeManager.removeByName(names as string[]);
mySmithingRecipeManager.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
// SmithingRecipeManager.removeByRegex(regex as string, exclude as function(t as string) as bool = (name as string) as bool => false);
mySmithingRecipeManager.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
// SmithingRecipeManager.removeMatching(predicate as function(t as RecipeHolder<Recipe>) as bool);
mySmithingRecipeManager.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.