    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 RenderIronGolem extends RenderLiving
    010    {
    011        /** Iron Golem's Model. */
    012        private ModelIronGolem ironGolemModel;
    013
    014        public RenderIronGolem()
    015        {
    016            super(new ModelIronGolem(), 0.5F);
    017            this.ironGolemModel = (ModelIronGolem)this.mainModel;
    018        }
    019
    020        /**
    021         * Renders the Iron Golem.
    022         */
    023        public void doRenderIronGolem(EntityIronGolem par1EntityIronGolem, double par2, double par4, double par6, float par8, float par9)
    024        {
    025            super.doRenderLiving(par1EntityIronGolem, par2, par4, par6, par8, par9);
    026        }
    027
    028        /**
    029         * Rotates Iron Golem corpse.
    030         */
    031        protected void rotateIronGolemCorpse(EntityIronGolem par1EntityIronGolem, float par2, float par3, float par4)
    032        {
    033            super.rotateCorpse(par1EntityIronGolem, par2, par3, par4);
    034
    035            if ((double)par1EntityIronGolem.legYaw >= 0.01D)
    036            {
    037                float var5 = 13.0F;
    038                float var6 = par1EntityIronGolem.legSwing - par1EntityIronGolem.legYaw * (1.0F - par4) + 6.0F;
    039                float var7 = (Math.abs(var6 % var5 - var5 * 0.5F) - var5 * 0.25F) / (var5 * 0.25F);
    040                GL11.glRotatef(6.5F * var7, 0.0F, 0.0F, 1.0F);
    041            }
    042        }
    043
    044        /**
    045         * Renders Iron Golem Equipped items.
    046         */
    047        protected void renderIronGolemEquippedItems(EntityIronGolem par1EntityIronGolem, float par2)
    048        {
    049            super.renderEquippedItems(par1EntityIronGolem, par2);
    050
    051            if (par1EntityIronGolem.getHoldRoseTick() != 0)
    052            {
    053                GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    054                GL11.glPushMatrix();
    055                GL11.glRotatef(5.0F + 180.0F * this.ironGolemModel.ironGolemRightArm.rotateAngleX / (float)Math.PI, 1.0F, 0.0F, 0.0F);
    056                GL11.glTranslatef(-0.6875F, 1.25F, -0.9375F);
    057                GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
    058                float var3 = 0.8F;
    059                GL11.glScalef(var3, -var3, var3);
    060                int var4 = par1EntityIronGolem.getBrightnessForRender(par2);
    061                int var5 = var4 % 65536;
    062                int var6 = var4 / 65536;
    063                OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)var5 / 1.0F, (float)var6 / 1.0F);
    064                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    065                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    066                this.loadTexture("/terrain.png");
    067                this.renderBlocks.renderBlockAsItem(Block.plantRed, 0, 1.0F);
    068                GL11.glPopMatrix();
    069                GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    070            }
    071        }
    072
    073        protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2)
    074        {
    075            this.renderIronGolemEquippedItems((EntityIronGolem)par1EntityLiving, par2);
    076        }
    077
    078        protected void rotateCorpse(EntityLiving par1EntityLiving, float par2, float par3, float par4)
    079        {
    080            this.rotateIronGolemCorpse((EntityIronGolem)par1EntityLiving, par2, par3, par4);
    081        }
    082
    083        public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
    084        {
    085            this.doRenderIronGolem((EntityIronGolem)par1EntityLiving, par2, par4, par6, par8, par9);
    086        }
    087
    088        /**
    089         * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
    090         * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
    091         * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
    092         * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
    093         */
    094        public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
    095        {
    096            this.doRenderIronGolem((EntityIronGolem)par1Entity, par2, par4, par6, par8, par9);
    097        }
    098    }