    001    package net.minecraft.client.renderer.entity;
    002
    003    import cpw.mods.fml.relauncher.Side;
    004    import cpw.mods.fml.relauncher.SideOnly;
    005    import net.minecraft.client.model.ModelWither;
    006    import net.minecraft.entity.Entity;
    007    import net.minecraft.entity.EntityLiving;
    008    import net.minecraft.entity.boss.BossStatus;
    009    import net.minecraft.entity.boss.EntityWither;
    010    import net.minecraft.util.MathHelper;
    011    import org.lwjgl.opengl.GL11;
    012
    013    @SideOnly(Side.CLIENT)
    014    public class RenderWither extends RenderLiving
    015    {
    016        private int field_82419_a;
    017
    018        public RenderWither()
    019        {
    020            super(new ModelWither(), 1.0F);
    021            this.field_82419_a = ((ModelWither)this.mainModel).func_82903_a();
    022        }
    023
    024        public void func_82418_a(EntityWither par1EntityWither, double par2, double par4, double par6, float par8, float par9)
    025        {
    026            BossStatus.func_82824_a(par1EntityWither, true);
    027            int var10 = ((ModelWither)this.mainModel).func_82903_a();
    028
    029            if (var10 != this.field_82419_a)
    030            {
    031                this.field_82419_a = var10;
    032                this.mainModel = new ModelWither();
    033            }
    034
    035            super.doRenderLiving(par1EntityWither, par2, par4, par6, par8, par9);
    036        }
    037
    038        protected void func_82415_a(EntityWither par1EntityWither, float par2)
    039        {
    040            int var3 = par1EntityWither.func_82212_n();
    041
    042            if (var3 > 0)
    043            {
    044                float var4 = 2.0F - ((float)var3 - par2) / 220.0F * 0.5F;
    045                GL11.glScalef(var4, var4, var4);
    046            }
    047            else
    048            {
    049                GL11.glScalef(2.0F, 2.0F, 2.0F);
    050            }
    051        }
    052
    053        protected int func_82417_a(EntityWither par1EntityWither, int par2, float par3)
    054        {
    055            if (par1EntityWither.isArmored())
    056            {
    057                if (par1EntityWither.getHasActivePotion())
    058                {
    059                    GL11.glDepthMask(false);
    060                }
    061                else
    062                {
    063                    GL11.glDepthMask(true);
    064                }
    065
    066                if (par2 == 1)
    067                {
    068                    float var4 = (float)par1EntityWither.ticksExisted + par3;
    069                    this.loadTexture("/armor/witherarmor.png");
    070                    GL11.glMatrixMode(GL11.GL_TEXTURE);
    071                    GL11.glLoadIdentity();
    072                    float var5 = MathHelper.cos(var4 * 0.02F) * 3.0F;
    073                    float var6 = var4 * 0.01F;
    074                    GL11.glTranslatef(var5, var6, 0.0F);
    075                    this.setRenderPassModel(this.mainModel);
    076                    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    077                    GL11.glEnable(GL11.GL_BLEND);
    078                    float var7 = 0.5F;
    079                    GL11.glColor4f(var7, var7, var7, 1.0F);
    080                    GL11.glDisable(GL11.GL_LIGHTING);
    081                    GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
    082                    GL11.glTranslatef(0.0F, -0.01F, 0.0F);
    083                    GL11.glScalef(1.1F, 1.1F, 1.1F);
    084                    return 1;
    085                }
    086
    087                if (par2 == 2)
    088                {
    089                    GL11.glMatrixMode(GL11.GL_TEXTURE);
    090                    GL11.glLoadIdentity();
    091                    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    092                    GL11.glEnable(GL11.GL_LIGHTING);
    093                    GL11.glDisable(GL11.GL_BLEND);
    094                }
    095            }
    096
    097            return -1;
    098        }
    099
    100        protected int func_82416_b(EntityWither par1EntityWither, int par2, float par3)
    101        {
    102            return -1;
    103        }
    104
    105        /**
    106         * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
    107         * entityLiving, partialTickTime
    108         */
    109        protected void preRenderCallback(EntityLiving par1EntityLiving, float par2)
    110        {
    111            this.func_82415_a((EntityWither)par1EntityLiving, par2);
    112        }
    113
    114        /**
    115         * Queries whether should render the specified pass or not.
    116         */
    117        protected int shouldRenderPass(EntityLiving par1EntityLiving, int par2, float par3)
    118        {
    119            return this.func_82417_a((EntityWither)par1EntityLiving, par2, par3);
    120        }
    121
    122        protected int inheritRenderPass(EntityLiving par1EntityLiving, int par2, float par3)
    123        {
    124            return this.func_82416_b((EntityWither)par1EntityLiving, par2, par3);
    125        }
    126
    127        public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
    128        {
    129            this.func_82418_a((EntityWither)par1EntityLiving, par2, par4, par6, par8, par9);
    130        }
    131
    132        /**
    133         * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
    134         * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
    135         * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
    136         * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
    137         */
    138        public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
    139        {
    140            this.func_82418_a((EntityWither)par1Entity, par2, par4, par6, par8, par9);
    141        }
    142    }