Posted October 3, 20169 yr I have created a block wich comes in 16 types (the 16 colors). All is working fine, they have the right texture but the item does not. this is the blockstate for BlockBricks.json: { "variants": { "type=white": { "model":"tem:bricks_white" }, "type=orange": { "model":"tem:bricks_orange" }, "type=magenta": { "model":"tem:bricks_magenta" }, "type=light_blue": { "model":"tem:bricks_light_blue" }, "type=yellow": { "model":"tem:bricks_yellow" }, "type=lime": { "model":"tem:bricks_lime" }, "type=pink": { "model":"tem:bricks_pink" }, "type=gray": { "model":"tem:bricks_gray" }, "type=silver": { "model":"tem:bricks_silver" }, "type=cyan": { "model":"tem:bricks_cyan" }, "type=purple": { "model":"tem:bricks_purple" }, "type=blue": { "model":"tem:bricks_blue" }, "type=brown": { "model":"tem:bricks_brown" }, "type=green": { "model":"tem:bricks_green" }, "type=red": { "model":"tem:bricks_red" }, "type=black": { "model":"tem:bricks_black" } } } this is 1 of the 16 block models (bricks_black.json): { "parent":"block/cube_all", "textures": { "all": "tem:blocks/bricks_black" } } the other 15 looks the same, only other color name. this is my item model for BlockBricks.json: { "parent": "block/cube_all", "textures": { "all": "tem:blocks/bricks_black" } } ofc this only set the first of all 16 items. So ingame i have 1 item with a texture and the other 15 not. Since the item model json has to be the same name as the registryname, i have no clue Try out my new Modpack for MC 1.15.2 https://www.curseforge.com/minecraft/modpacks/terran-civilization
October 3, 20169 yr Since the item model json has to be the same name as the registryname, i have no clue This isn't the case. You can register any model for your items, the registry name is simply the default. You need to call ModelLoader.setCustomModelResourceLocation for each metadata value of the Item . The ModelResourceLocation can either point to an item model or a variant of a blockstates file. I have an explanation of the model loading process and how ModelResourceLocation s are mapped to models here. Consider using Forge's blockstates format, it eliminates the need to create a model file for every variant of your block. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
October 3, 20169 yr Author oh yes i got it working now: public static void registerRenders(){ registerRender(cheese); registerMetaRender(bricks,0,"bricks_white"); registerMetaRender(bricks,1,"bricks_orange"); registerMetaRender(bricks,2,"bricks_magenta"); registerMetaRender(bricks,3,"bricks_light_blue"); } private static void registerMetaRender(Block block, int meta, String file){ ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), meta, new ModelResourceLocation(References.MOD_ID + ":" + file,"inventory")); //Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(),"inventory")); } I will check on the Forge blockstates format Try out my new Modpack for MC 1.15.2 https://www.curseforge.com/minecraft/modpacks/terran-civilization
October 3, 20169 yr Author the forge blockstates format looks a bit diffecult to understand. If i would use 1 model file how would i pass all the 16 types from my blockstate json to the model json? That's something i don't understand. Now for every type i have a model file. Can you help me explain this better. I read the example on the page there, but i don't understand it Edit: I tried this { "forge_marker": 1, "defaults": { "textures": { "texture": "tem:blocks/bricks_white", }, "model": "block/cube_all", "uvlock": true }, "variants": { "type": { "white":{ "textures": { "texture": "tem:blocks/bricks_white" } } } } } that doesn't work Try out my new Modpack for MC 1.15.2 https://www.curseforge.com/minecraft/modpacks/terran-civilization
October 3, 20169 yr the forge blockstates format looks a bit diffecult to understand. If i would use 1 model file how would i pass all the 16 types from my blockstate json to the model json? That's something i don't understand. Now for every type i have a model file. Can you help me explain this better. I read the example on the page there, but i don't understand it In the defaults section, you set the model to the base model, e.g. minecraft:cube_all . For each variant, you set the all texture to the appropriate texture for that variant. I have a basic example here and a more complex example here. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
October 3, 20169 yr Author i have this and it works : { "forge_marker": 1, "defaults": { "model": "minecraft:cube_all" }, "variants": { "type": { "white": { "textures": { "all": "tem:blocks/bricks_white" } }, "orange": { "textures": { "all": "tem:blocks/bricks_orange" } }, "magenta": { "textures": { "all": "tem:blocks/bricks_magenta" } }, "light_blue": { "textures": { "all": "tem:blocks/bricks_light_blue" } }, "yellow": { "textures": { "all": "tem:blocks/bricks_yellow" } }, "lime": { "textures": { "all": "tem:blocks/bricks_lime" } }, "pink": { "textures": { "all": "tem:blocks/bricks_pink" } }, "gray": { "textures": { "all": "tem:blocks/bricks_gray" } }, "silver": { "textures": { "all": "tem:blocks/bricks_silver" } }, "cyan": { "textures": { "all": "tem:blocks/bricks_cyan" } }, "purple": { "textures": { "all": "tem:blocks/bricks_purple" } }, "blue": { "textures": { "all": "tem:blocks/bricks_blue" } }, "brown": { "textures": { "all": "tem:blocks/bricks_brown" } }, "green": { "textures": { "all": "tem:blocks/bricks_green" } }, "red": { "textures": { "all": "tem:blocks/bricks_red" } }, "black": { "textures": { "all": "tem:blocks/bricks_black" } } } } } Do i have to do the same for the item model? Try out my new Modpack for MC 1.15.2 https://www.curseforge.com/minecraft/modpacks/terran-civilization
October 3, 20169 yr Do i have to do the same for the item model? No, you can tell Minecraft to use the variants from your blockstates file as the models for your item. Use the name of the blockstates file as the domain and path of the ModelResourceLocation and the variant as the variant. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
October 3, 20169 yr Author What do i need to change here? the "inventory"? private static void registerMetaRender(Block block, int meta){ ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), meta, new ModelResourceLocation(block.getRegistryName(),"inventory")); } Try out my new Modpack for MC 1.15.2 https://www.curseforge.com/minecraft/modpacks/terran-civilization
October 3, 20169 yr I think you can replace it with "property=variant", but don't quote me on that. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
October 3, 20169 yr Author I think i still don't understand how this works. I see an error in the console: Caused by: java.io.FileNotFoundException: tem:models/item/BlockBricks.json I'm confused now , i thought i didn't need to make a model for it. Edit: i have also this: [12:40:17] [Client thread/ERROR] [FML]: Exception loading model for variant tem:blockstates/BlockBrick#variants for item "tem:BlockBricks", blockstate location exception: Try out my new Modpack for MC 1.15.2 https://www.curseforge.com/minecraft/modpacks/terran-civilization
October 3, 20169 yr I think i still don't understand how this works. I see an error in the console: Caused by: java.io.FileNotFoundException: tem:models/item/BlockBricks.json I'm confused now , i thought i didn't need to make a model for it. Edit: i have also this: [12:40:17] [Client thread/ERROR] [FML]: Exception loading model for variant tem:blockstates/BlockBrick#variants for item "tem:BlockBricks", blockstate location exception: Forge always tries to load the item model first and falls back to the blockstates file if that fails. If both fail, it logs both exceptions. Your blockstates file doesn't have a variant called variants , so an exception is thrown when Forge tries to load the model for that variant. The variants specified by your blockstates file are type=white , type=orange , etc. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
October 3, 20169 yr Author Nice thank you very much. I have it working now: public static void registerRenders(){ registerRender(cheese); registerMetaRender(bricks,0,"type=white"); registerMetaRender(bricks,1,"type=orange"); registerMetaRender(bricks,2,"type=magenta"); registerMetaRender(bricks,3,"type=light_blue"); registerMetaRender(bricks,4,"type=yellow"); registerMetaRender(bricks,5,"type=lime"); registerMetaRender(bricks,6,"type=pink"); registerMetaRender(bricks,7,"type=gray"); registerMetaRender(bricks,8,"type=silver"); registerMetaRender(bricks,9,"type=cyan"); registerMetaRender(bricks,10,"type=purple"); registerMetaRender(bricks,11,"type=blue"); registerMetaRender(bricks,12,"type=brown"); registerMetaRender(bricks,13,"type=green"); registerMetaRender(bricks,14,"type=red"); registerMetaRender(bricks,15,"type=black"); } private static void registerMetaRender(Block block, int meta, String variant){ ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), meta, new ModelResourceLocation(block.getRegistryName(),variant)); } private static void registerRender(Block block){ ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(),"inventory")); //Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(),"inventory")); } Try out my new Modpack for MC 1.15.2 https://www.curseforge.com/minecraft/modpacks/terran-civilization
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.