June 19, 201510 yr EDIT: I have no idea why I thought you were making a Block... In addition to registering your variants, you also need to make an ItemBlock class, or use ItemMultiTexture from vanilla, that returns the correct damage value for the stack, as well as register each renderer for the correct item damage value: @Override public int getMetadata(int damage) { return damage; } // register each of your variant's resource locations with the correct damage value, assuming they are in an array: for (int i = 0; i < variants.length; ++i) { mesher.register(this, i, new ModelResourceLocation(variants[i], "inventory")); } I guess in your case, you'd just need to add each damage value for your Programmer registration, as you just have '0'. Btw, when you register a variant, I'm pretty sure you need to fully qualify the name, e.g. "yourmodid:empty". Also, I'm sure someone mentioned it before, but you should use your proxy for registering the model resource locations and variants. http://i.imgur.com/NdrFdld.png[/img]
June 19, 201510 yr Also: Did you do ModelBakery.addVariantName(...) in your ClientProxy#preInit()? https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe03_block_variants Everything is here. 1.7.10 is no longer supported by forge, you are on your own.
June 19, 201510 yr Also: Did you do ModelBakery.addVariantName(...) in your ClientProxy#preInit()? That's a good point - you need to add variants during preInit, but register to ItemModelMesher during regular init. http://i.imgur.com/NdrFdld.png[/img]
June 19, 201510 yr Author ok, ok. ill try all your examples. Someone tell me why THIS works then. Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Program, 0, new ModelResourceLocation(MODID + ":copperIngot", "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Program, 1, new ModelResourceLocation(MODID + ":copperIngot", "inventory"));
June 19, 201510 yr When minecraft starts, in preInit() you need to tell it to load all model files. If there is one item or one block - it will do it automatically. When block or item has variants - you need to tell it that "hey, also load this model.json". Then in init() you need to tell MC to assign registered and baked models to item and itemMeta. Why it does work: You are using same texture (same model) for both metadata variants of item. This model is registered. What you do is only assign model to its meta item. When it will stop working: if you make 2 models for 2 different meta, only one will work or neither if variant changes unlocalized name of item (which is possible). EDIT Fixed lot of typos (I just woke up). 1.7.10 is no longer supported by forge, you are on your own.
June 19, 201510 yr Author ok ok. I see your logic. But why then, does this not work? Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(demonBar, 0, new ModelResourceLocation(MODID + ":empty", "inventory")); demonBar only has 1 variant, but the "empty" model isn't showing. Why? Also, good morning
June 19, 201510 yr Author Also if you think that its something wrong with the model file, its not. I copied and pasted everything from a working model into empty.json (even the texture is the same).
June 19, 201510 yr MC will only bake default models. If "empty" is something that is NEVER registered, it's not baked (in preInit) - thus you cannot assign it to anything (in init). If I'd have to debug it you would need to post your proxies, all json files and block/item initialization. Post src on Git - you will get direct help much faster. Seriously man - just go to MCByExample - EVERYTHING is there if you follow it VERY thorough. There is nothing left to say. 1.7.10 is no longer supported by forge, you are on your own.
June 19, 201510 yr Author nothing else is registered in preinit and they work? I just don't know what "empty" doesn't work, but everything else works. But sure, let me put em in preinit.
June 19, 201510 yr If your 'empty' model isn't showing no matter where you try it, then the problem must be either with the model or the texture, and my bet is on the model. I've copied and pasted plenty of models, and about half the time I ended up with texture issues like this because I forgot to add or remove 's' from 'block' or 'item' in the texture or model name, i.e. models are in 'block' or 'item', but textures are in 'blocks' or 'items'. The point is, just because you copied and pasted it, doesn't mean there isn't a problem. Post your empty.json model contents. EDIT: Actually, I think Ernio has the right of it, as if you messed up on the naming, you should have gotten an error message in the console which you clearly didn't. Oh well. http://i.imgur.com/NdrFdld.png[/img]
June 19, 201510 yr Author A working model: { "parent": "tiffitmachines:builtin/generated", "textures": { "layer0": "tiffitmachines:items/fireBar" }, "display": { "thirdperson": { "rotation": [ -90, 0, 0 ], "translation": [ 0, 1, -3 ], "scale": [ 0.55, 0.55, 0.55 ] }, "firstperson": { "rotation": [ 0, -135, 25 ], "translation": [ 0, 4, 2 ], "scale": [ 1.7, 1.7, 1.7 ] } } } empty.json: { "parent": "tiffitmachines:builtin/generated", "textures": { "layer0": "tiffitmachines:items/fireBar" }, "display": { "thirdperson": { "rotation": [ -90, 0, 0 ], "translation": [ 0, 1, -3 ], "scale": [ 0.55, 0.55, 0.55 ] }, "firstperson": { "rotation": [ 0, -135, 25 ], "translation": [ 0, 4, 2 ], "scale": [ 1.7, 1.7, 1.7 ] } } } I have everything like the minecraft by example. My model bakery is in preInit. Are you guys stumped? Cause I definitely am.
June 19, 201510 yr Author I fixed it! For some reason eclipse was not overriding the files when refreshing, so I did it manually and it works now!
June 19, 201510 yr FML's log not the console/crall MC log that doesn't include 90% of the output. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
June 19, 201510 yr Author FML's log not the console/crall MC log that doesn't include 90% of the output. Oh sorry, my mistake.
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.