Tarif Yöneticileri

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:

ZenScript
Copy
<recipetype:modid:name>

Some examples are:

ZenScript
Copy
<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
Blasting<recipetype:minecraft:blasting>blastFurnace
Campfire Cooking<recipetype:minecraft:campfire_cooking>campfire
Crafting<recipetype:minecraft:crafting>craftingTable
Smelting<recipetype:minecraft:smelting>furnace
Smithing<recipetype:minecraft:smithing>smithing
Smoking<recipetype:minecraft:smoking>smoker
Stone Cutting<recipetype:minecraft:stonecutting>stoneCutter

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

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

Is the same as doing:

ZenScript
Copy
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

getRecipeByName

This method gets a recipe by it's name, and returns a WrapperRecipe.

ZenScript
Copy
getRecipeByName(String name);

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

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

getRecipesByOutput

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

ZenScript
Copy
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.

ZenScript
Copy
for recipe in craftingTable.getRecipeByName(<item:minecraft:stick>) {
    println("> " + recipe.id);
    for ingredient in recipe.ingredients {
        println(ingredient.commandString);
    }
}

getAllRecipes

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

ZenScript
Copy
getAllRecipes();

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

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

removeRecipe

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

ZenScript
Copy
removeRecipe(IItemStack output);

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

ZenScript
Copy
craftingTable.removeRecipe(<item:minecraft:stick>);

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

ZenScript
Copy
furnace.removeRecipe(<item:minecraft:diamond>);

removeByName

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

ZenScript
Copy
removeByName(String name);

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

ZenScript
Copy
craftingTable.removeByName("minecraft:arrow");

removeByModid

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:orage_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

ZenScript
Copy
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:

ZenScript
Copy
craftingTable.removeByModid("minecraft");

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

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

removeByRegex

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

ZenScript
Copy
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).

ZenScript
Copy
craftingTable.removeByRegex(".*wool.*");

removeAll

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

ZenScript
Copy
removeAll(String regex);

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

ZenScript
Copy
blastFurnace.removeAll();