Home Commands Examples Getting Started With Scripts Global Keywords

Recipe Managers

Recipe Managers are crafting systems (like the Crafting Table, Furnace or Camp Fire) that use the Vanilla Data Pack JSON system.
Most Recipe Managers have the same removal methods but different methods to add recipes.

Recipe Managers are generally what you will be using to interact with recipes in the game, there are however some mods that don’t use the DataPack JSON system, and for those mods you would need to add and remove recipes differently.

Referencing Recipe Managers

Recipe Managers are usually referenced via a Bracket Handler (the exception being Vanilla Recipe Managers which can be referenced via a global value).
The Recipe manager format is:

script.zs
<recipetype:modid:name>

Some examples are:

script.zs
<recipetype:minecraft:smoking> // References the Smoking Recipe Manager
<recipetype:botania:mana_infusion> // References the Botania Mana Infusion Recipe Manager
<recipetype:thermal:pulverizer> // References the Thermal Expansion Pulverizer Recipe Manager

Vanilla Recipe Managers are special as they have dedicated Global Variables that allow you to reference them without using a BracketHandler.

The Vanilla Recipe Managers are:

Recipe ManagerBracket HandlerGlobal Variable
Recipe Manager
Blasting
Bracket Handler
Global Variable
blastFurnace
Recipe Manager
Campfire Cooking
Bracket Handler
Global Variable
campfire
Recipe Manager
Crafting
Bracket Handler
Global Variable
craftingTable
Recipe Manager
Smelting
Bracket Handler
Global Variable
furnace
Recipe Manager
Smithing
Bracket Handler
Global Variable
smithing
Recipe Manager
Smoking
Bracket Handler
Global Variable
smoker
Recipe Manager
Stone Cutting
Bracket Handler
Global Variable
stoneCutter

The Vanilla Recipe Managers can be referenced by either their Bracket Handler or the Global Variable, for example:

script.zs
<recipetype:minecraft:blasting>.removeAll() // Removes all Blast Furnace Recipes

Is the same as doing:

script.zs
blastFurnace.removeAll() // Removes all Blast Furnace Recipes

The Global Variables just allow the Recipe Managers to be referenced easier.

The reason that not all Recipe Managers are given Global Variables is that there would be conflicting names if two different mods both added a machine with the same name, such as two mods adding Crushers.

Methods

This method gets a recipe by it’s name, and returns a Recipe.

script.zs
getRecipeByName(String name);

You could use this method to get the ingredients of a recipe and print the commandString of each ingredient.

script.zs
for ingredient in craftingTable.getRecipeByName("minecraft:arrow").ingredients {
println(ingredient.commandString);
}

This method gets a list of recipes based on their outputs, and returns a list of Recipe.

script.zs
getRecipesByOutput(IIngredient name);

You could use this method to get the ingredients of all the recipes that output a certain item and print the commandString of each ingredient of each recipe.

script.zs
for recipe in craftingTable.getRecipesByOutput(<item:minecraft:stick>) {
println("> " + recipe.id);
for ingredient in recipe.ingredients {
println(ingredient.commandString);
}
}

This method gets a list of all the recipes for the Recipe Manager and returns a list of Recipe.

script.zs
getAllRecipes();

You could use this method to get the ingredients of all the recipes and print the commandString of each ingredient of each recipe.

script.zs
for recipe in furnace.getAllRecipes() {
println("> " + recipe.id);
for ingredient in recipe.ingredients {
println(ingredient.commandString);
}
}

This method allows you to remove recipes from this Recipe Manager by the recipe’s output item.

script.zs
remove(IItemStack output);

An example use case for this method is removing the recipe for Sticks from the Crafting Table:

script.zs
craftingTable.remove(<item:minecraft:stick>);

Another example of this method would be removing the Diamond Ore to Diamond recipe from the furnace:

script.zs
furnace.remove(<item:minecraft:diamond>);

This method allows you to remove recipes from this Recipe Manager by the recipe’s name.

script.zs
removeByName(String name);

An example use case for this method is removing the recipe for an Arrow from the Crafting Table:

script.zs
craftingTable.removeByName("minecraft:arrow");

This method allows you to remove recipes from this Recipe Manager based on the the recipe name’s modid.
There is an optional parameter that is used to exclude recipes from being removed.
Note: The name given to the RecipeFilter is just the path of the recipe id.
For example, if the recipe id is minecraft:orange_wool, the name given will be orange_wool. Another example would be the recipe id modid:path/name, the name given will be path/name

script.zs
removeByModid(String modid);
or
removeByModid(String modid, RecipeFilter exclude);

An example use case for this method is removing all the recipe from “minecraft” from the Crafting Table:

script.zs
craftingTable.removeByModid("minecraft");

Another use case would be removing all the recipes from “minecraft” excluding the recipe for Orange Wool.

script.zs
craftingTable.removeByModid("minecraft", (name as string) => {
return name == "orange_wool";
});

This method allows you to remove recipes from this Recipe Manager by testing the recipe’s id against a regex pattern.

script.zs
removeByRegex(String regex);

An example use case for this method is removing all recipes who’s id matches .*wool.* (anything that has the work wool in it).

script.zs
craftingTable.removeByRegex(".*wool.*");

This method allows you to remove all the recipes from the Recipe Manager.

script.zs
removeAll(String regex);

An example use case for this method is removing all the Blast Furnace recipes.

script.zs
blastFurnace.removeAll();