User Tools

Site Tools


tutorial:dynamic_recipe_generation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
dynamic_recipe_generation [2020/10/11 16:48] – [RecipeManager Mixin] deathuntertutorial:dynamic_recipe_generation [2022/04/14 09:11] – Mark outdated daomephsta
Line 1: Line 1:
-====== Dynamic Recipe Registration ======+====== Outdated ====== 
 +The approach outlined in this tutorial should not be used. It can be replaced with a combination of the [[https://github.com/FabricMC/fabric/tree/1.18.2/fabric-data-generation-api-v1/src|Fabric Data Generation API]] & the [[https://github.com/FabricMC/fabric/tree/1.18.2/fabric-resource-conditions-api-v1/src|Fabric Resource Conditions API]]. If runtime data generation is necessary, use [[https://github.com/Devan-Kerman/ARRP|Advanced Runtime Resource Packs]].
  
 +====== Dynamic Recipe Generation ======
 Dynamically added recipes are recipes added through code instead of .json files. This can be used for, for example, changing a recipe if a certain mod is installed alongside your mod, or changing the recipe to use tags from another mod. Dynamically added recipes are recipes added through code instead of .json files. This can be used for, for example, changing a recipe if a certain mod is installed alongside your mod, or changing the recipe to use tags from another mod.
  
Line 86: Line 88:
             if (FabricLoader.getInstance().isModLoaded("custom_mod")) {             if (FabricLoader.getInstance().isModLoaded("custom_mod")) {
                 COPPER_PICKAXE_RECIPE = createShapedRecipeJson(                 COPPER_PICKAXE_RECIPE = createShapedRecipeJson(
-                    new ArrayList<Character>(){{ +                    Lists.newArrayList
-                        add('#'); +                        '#', 
-                        add('|'); +                        '|' 
-                    }}, //The keys we are using for the input items/tags. +                    ), //The keys we are using for the input items/tags. 
-                    new ArrayList<Identifier>(){{ +                    Lists.newArrayList(new Identifier("c", "copper_ingots")new Identifier("stick")), //The items/tags we are using as input. 
-                        add(new Identifier("c", "copper_ingots")); +                    Lists.newArrayList("tag""item"), //Whether the input we provided is a tag or an item. 
-                        add(new Identifier("stick")+                    Lists.newArrayList
-                    }}, //The items/tags we are using as input. +                        "###", 
-                    new ArrayList<String>(){{ +                        " | ", 
-                        add("tag"); +                        " | " 
-                        add("item")+                    ), //The crafting pattern.
-                    }}, //Whether the input we provided is a tag or an item. +
-                    new ArrayList<String>(){{ +
-                        add("###"); +
-                        add(" | "); +
-                        add(" | "); +
-                    }}, //The crafting pattern.+
                     new Identifier("examplemod:copper_pickaxe") //The crafting output                     new Identifier("examplemod:copper_pickaxe") //The crafting output
                 );                 );
tutorial/dynamic_recipe_generation.txt · Last modified: 2022/11/05 12:04 by jab125