    001    package net.minecraft.client.renderer.tileentity;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005    import net.minecraft.client.model.ModelChest;
    006    import net.minecraft.tileentity.TileEntity;
    007    import net.minecraft.tileentity.TileEntityEnderChest;
    008    import org.lwjgl.opengl.GL11;
    009    import org.lwjgl.opengl.GL12;
    010
    011    @SideOnly(Side.CLIENT)
    012    public class TileEntityEnderChestRenderer extends TileEntitySpecialRenderer
    013    {
    014        /** The Ender Chest Chest's model. */
    015        private ModelChest theEnderChestModel = new ModelChest();
    016
    017        /**
    018         * Helps to render Ender Chest.
    019         */
    020        public void renderEnderChest(TileEntityEnderChest par1TileEntityEnderChest, double par2, double par4, double par6, float par8)
    021        {
    022            int var9 = 0;
    023
    024            if (par1TileEntityEnderChest.func_70309_m())
    025            {
    026                var9 = par1TileEntityEnderChest.getBlockMetadata();
    027            }
    028
    029            this.bindTextureByName("/item/enderchest.png");
    030            GL11.glPushMatrix();
    031            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    032            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    033            GL11.glTranslatef((float)par2, (float)par4 + 1.0F, (float)par6 + 1.0F);
    034            GL11.glScalef(1.0F, -1.0F, -1.0F);
    035            GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    036            short var10 = 0;
    037
    038            if (var9 == 2)
    039            {
    040                var10 = 180;
    041            }
    042
    043            if (var9 == 3)
    044            {
    045                var10 = 0;
    046            }
    047
    048            if (var9 == 4)
    049            {
    050                var10 = 90;
    051            }
    052
    053            if (var9 == 5)
    054            {
    055                var10 = -90;
    056            }
    057
    058            GL11.glRotatef((float)var10, 0.0F, 1.0F, 0.0F);
    059            GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    060            float var11 = par1TileEntityEnderChest.prevLidAngle + (par1TileEntityEnderChest.lidAngle - par1TileEntityEnderChest.prevLidAngle) * par8;
    061            var11 = 1.0F - var11;
    062            var11 = 1.0F - var11 * var11 * var11;
    063            this.theEnderChestModel.chestLid.rotateAngleX = -(var11 * (float)Math.PI / 2.0F);
    064            this.theEnderChestModel.renderAll();
    065            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    066            GL11.glPopMatrix();
    067            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    068        }
    069
    070        public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8)
    071        {
    072            this.renderEnderChest((TileEntityEnderChest)par1TileEntity, par2, par4, par6, par8);
    073        }
    074    }