Recipe Handling
Recipes are a big part of Minecraft. That is why this mod offers first-class support for them via Recipe values, and Ingredients values to represent their input and output collections. In this tutorial, we will have a look at how recipes can be obtained and used.
The easiest way to obtain Recipes is simply by reading it from a machine that can handle recipes. So let's start by reading all crafting recipes by placing a Machine Reader against a Crafting Table and reading the list of recipes.
If you want some more fine-grained control over recipes, or if you are working with a machine that does not expose its recipes via the Machine Reader, you can visually create a Recipe yourself in the Logic Programmer. Let's try creating a simple recipe, for example for crafting a Chest.
In this last part of the tutorial, we'll take recipe reading one step further. Using the Recipe By Output aspect, we can retrieve an operator that, when applied to an Ingredients instance, will return the first Recipe that returns the given Ingredients as output. We will use this to look up the recipe of a Chest.
Let's start by creating an Ingredients instance with a single Chest in your Logic Programmer. Next, read the Recipe By Output aspect from a Machine Reader that targets a Crafting Table. After that, use the Apply operator to apply your Chest Ingredient to the operator you got from the Machine Reader. Finally, insert the resulting variable into a Display Panel to see the Chest's recipe. (Don't forget to insert all your used variables into a Variable Store).
Obviously, there is much more you can do with Recipes and Ingredients. Have a look in the Machine Reader and Logic Programmer to find out what other advanced functionality is available to you.
输出: List(列表)
输出: Operator(运算符)
- Operator(运算符)
- §rAny(任意)§0
- §rAny(任意)§0