Posted May 26, 201510 yr I have a custom chest that renders fine in the world using a TESR, but in the inventory it renders as a vanilla chest (achieved by using {"parent": "builtin/entity"} in the item model json). In 1.7.10, I got it working using an ISBRH with a dummy TileEntity of my custom chest, and had that render during #renderInventoryBlock. I tried something similar using ISmartItemModel, but only with partial success: private static final TileEntityMyCustomChest dummy = new TileEntityMyCustomChest(); @Override public IBakedModel handleItemState(ItemStack stack) { GlStateManager.pushMatrix(); GlStateManager.scale(0.625D, 0.625D, 0.625D); GlStateManager.rotate(245.0F, 0.0F, 1.0F, 0.0F); GlStateManager.translate(-0.5F, -0.5F, -0.5F); TileEntityRendererDispatcher.instance.renderTileEntityAt(dummy, 0, 0, 0, 0); GlStateManager.popMatrix(); return defaultModel; } If I don't return the default model, the inventory uses the 'missing texture' icon. If I do return it, it renders as a vanilla chest. The item in the player's hand (i.e. in world, not inventory), though, renders with the appropriate custom texture, but the vanilla model renders underneath it making it look kind of funny. I'm thinking if I can return the TextureAtlasSprite for my own texture, I can forgo all that other stuff. I've looked around for a while trying to find where I can retrieve an existing TextureAtlasSprite / instantiate a new one with the current resource location (is that even a good idea?), but I have not had any luck yet. I suppose there's always Reflection. http://i.imgur.com/NdrFdld.png[/img]
June 4, 201510 yr Author Well, I was able to work around it by creating an actual .json model for the block and using that as the base for the item. The TileEntity and non-inventory views both use the TileEntitySpecialRenderer to render the vanilla ModelChest with my own texture, and the inventory view uses the block model from the .json which has the correct textures. I left off the lock model for the time being to see if it would work, but now that I see it does, why would Mojang hard-code the chest item rendering like they did rather than using the .json format? They could still use the TESR to render the animation and combined chests as needed... strange. Still, I wonder whether/how one can use the TileEntityRendererDispatcher to render in the inventory view, like vanilla does in TileEntityItemStackRenderer (at least I think that's where it's done for the inventory / hand-held views)? http://i.imgur.com/NdrFdld.png[/img]
June 4, 201510 yr Hi There was a thread a while back showing how you can use the dispatcher. It was a bit hacky and appears to have been deleted by the model rendering police -TGG
June 4, 201510 yr Author I was using the TileEntityRenderingDispatcher previously (as you can see in the first post), which worked fine for the block in the world and, after I made an ISmartItemModel, for the first and 3rd-person views as well. I never did manage to get it working for the inventory view, however, though I didn't play around with it too much before switching to using an actual .json model for my block, as opposed to trying to hitchhike on vanilla's code. Using the .json is much cleaner anyway, as now I don't need any TESR or custom item model, and it looks just like it should, lock and all. http://i.imgur.com/NdrFdld.png[/img]
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.