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