Integrated Dynamics - On the Dynamics of Integration

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.

Aspect
RecipesRecipes that can be handled by the target

Output: List

    Aspect
    Recipe By OutputAn operator that returns a recipe for a given output.

    Output: Operator

      Operator
      ApplyapplyApply for a given operator a given value.
      • Operator
      • §rAny§0
      • §rAny§0
      Global name: operatorApply(Operator, §rAny§0) → §rAny§0Method name: Operator.apply(§rAny§0) → §rAny§0
      Advancements
      • Recipe ReadingRead the list of recipes from a machine (like the Crafting Table) using a Machine Reader.
      • Recipe CreationVisually create a §8Recipe§7 using the Logic Programmer.
      • Recipe LookupDynamically lookup the recipe of a Chest using a Machine Reader.
      Recompensas
      Variable Card15
      Machine Reader5
      Display Panel5