Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Help with rendering item model on block with tile entity 1.12.2


chocolateimage
 Share

Recommended Posts

When i make a TileEntitySpecialRenderer and then use the render function to render the item the item rendered is flickered and it has texture glitches

 

public class ShelfTileRenderer extends TileEntitySpecialRenderer<TileEntityShelf> {
	@Override
	public void render(TileEntityShelf te, double x, double y, double z, float partialTicks, int destroyStage,
			float alpha) {
		GL11.glPushMatrix();
		GL11.glTranslatef((float)x + 0.5F, (float)y + 1.02F, (float)z + 0.3F);
		GL11.glRotatef(180, 0, 1, 1);
		//RenderManager.renderEntityWithPosYaw(this.entItem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
		//ItemStack is = te.itemInShelf.getStackInSlot(0);
		RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
		//IBakedModel ibakedmodel = itemRenderer.getItemModelWithOverrides(is, te.getWorld(), (EntityLivingBase)null);
		//IBakedModel transformedModel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false);
        //itemRenderer.renderItem(is, itemRenderer.getItemModelMesher().getItemModel(is));
		//ForgeHooksClient.renderLitItem(itemRenderer, itemRenderer.getItemModelMesher().getItemModel(is), -1, is);
		ItemStack itemstack = te.itemInShelf.getStackInSlot(0);

        

        GlStateManager.enableRescaleNormal();
        GlStateManager.alphaFunc(516, 0.1F);
        GlStateManager.enableBlend();
        RenderHelper.enableStandardItemLighting();
        GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
        IBakedModel ibakedmodel = itemRenderer.getItemModelWithOverrides(itemstack, te.getWorld(), (EntityLivingBase)null);

        IBakedModel transformedModel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false);
        itemRenderer.renderItem(itemstack, transformedModel);
        GlStateManager.disableRescaleNormal();
        GlStateManager.disableBlend();
		//Minecraft.getMinecraft().getRenderItem().renderItem(te.itemInShelf.getStackInSlot(0),);
		GL11.glPopMatrix();
	}
	
}

 

Quote

Here is the video that shows this weird thing

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.