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