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
dynamic_recipe_generation [2020/10/11 16:48] – [RecipeManager Mixin] deathuntertutorial:dynamic_recipe_generation [2022/11/05 12:04] (current) jab125
Line 1: Line 1:
-====== Dynamic Recipe Registration ======+:!: //This page has been replaced by the Fabric Data Generation API tutorials, [[tutorial:datagen_recipe|which you can find here.]]//
  
 +====== 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 87:
             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