User Tools

Site Tools


tutorial:dynamic_model_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
Last revisionBoth sides next revision
tutorial:dynamic_model_generation [2020/10/15 12:15] – ↷ Page moved from dynamic_model_generation to tutorial:dynamic_model_generation deathuntertutorial:dynamic_model_generation [2022/08/16 21:00] – external edit 127.0.0.1
Line 1: Line 1:
 +DELETEME //This page has been replaced by the Fabric Data Generation API tutorials, [[tutorial:datagen_model|which you can find here.]]//
 +
 ====== Dynamic Model Generation ====== ====== Dynamic Model Generation ======
 Dynamically generated models can mainly be used to add models to items or blocks that are generated, or if you want to auto-create them for a large number of items or blocks. Dynamically generated models can mainly be used to add models to items or blocks that are generated, or if you want to auto-create them for a large number of items or blocks.
Line 16: Line 18:
 <code java> <code java>
     public static String createItemModelJson(String id, String type) {     public static String createItemModelJson(String id, String type) {
-        if ("generated".equals(type) || "handheld".equals(type) {+        if ("generated".equals(type) || "handheld".equals(type)) {
         //The two types of items. "handheld" is used mostly for tools and the like, while "generated" is used for everything else.          //The two types of items. "handheld" is used mostly for tools and the like, while "generated" is used for everything else. 
             return "{\n" +             return "{\n" +
Line 27: Line 29:
         //However, if the item is a block-item, it will have a different model json than the previous two.         //However, if the item is a block-item, it will have a different model json than the previous two.
             return "{\n" +             return "{\n" +
-                   "  \"parent\": \"example_mod:block/" + id + "\"\n"+                   "  \"parent\": \"example_mod:block/" + id + "\"\n" +
                    "}";                    "}";
         }         }
Line 55: Line 57:
         model.id = id.toString();         model.id = id.toString();
         cir.setReturnValue(model);         cir.setReturnValue(model);
-        cir.cancel(); 
     }     }
 } }
 </code> </code>
tutorial/dynamic_model_generation.txt · Last modified: 2022/11/05 12:05 by jab125