Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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! 

  • 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)

  • 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?

  • 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 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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.