Posted May 7, 20178 yr Hello everyone, I am trying to make a tile entity special renderer that renders a json model that is not used by a block or an item. I've looked at the RendererItemFrame class, and there this thing: ibakedmodel = modelmanager.getModel(this.itemFrameModel); I've tried but it didn't work, I'm guessing you have to register the model first. My question is, how to do that? If it's not possible that way, how should I do that? Here is my code: @SideOnly(Side.CLIENT) public class TileEntityWorkBenchRenderer extends TileEntitySpecialRenderer<TileEntityWorkBench>{ public final Minecraft mc = Minecraft.getMinecraft(); @Override public void renderTileEntityAt(TileEntityWorkBench te, double x, double y, double z, float partialTicks, int destroyStage){ try{ this.mc.getRenderManager().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher(); ModelManager modelmanager = blockrendererdispatcher.getBlockModelShapes().getModelManager(); IBakedModel ibakedmodel; GlStateManager.pushMatrix(); GlStateManager.translate(x + 0.5D, y + 1D, z + 0.5D); ibakedmodel = modelmanager.getModel(new ModelResourceLocation(Reference.MOD_ID + ":workbench", "text")); GlStateManager.pushMatrix(); GlStateManager.translate(-0.5F, -0.5F, -0.5F); blockrendererdispatcher.getBlockModelRenderer().renderModelBrightnessColor(ibakedmodel, 1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); GlStateManager.translate(0.0F, 0.0F, 0.4375F); GlStateManager.popMatrix(); }catch(Exception e){ e.printStackTrace(); } } } The blockstate file: { "variants": { "normal": { "model": "modtest:workbench" }, "text": { "model": "modtest:workbench_text" } } } I've tried to load a model that is used by a block and it works ibakedmodel = modelmanager.getModel(new ModelResourceLocation(Reference.MOD_ID + ":workbench", "normal")); Note that I'm still new to modding and that I have no idea if I'm going for the right way. Thanks!
May 7, 20178 yr Author Well I was planning on using a TESR to render a custom model that would be rotating on top of the normal block model. (A crafting table with a floating rotating text model on top)
May 7, 20178 yr Author The TESR above is for the model that I'm planning to be rotating, I just haven't done it yet when I saw that the model wasn't loading. The fixed model is just the block of the tileentity. Also, could you explain what a FastTESR is please?
May 7, 20178 yr Author Ok, thanks for the answer! I would like to directly get the model and bake it if possible, but for me the ModelLoader.getModel method doesn't exist. Has it been replaced in 1.11.2? Edited May 7, 20178 yr by grand_gibus
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.