001package net.minecraft.client.renderer.entity;
002
003import cpw.mods.fml.relauncher.Side;
004import cpw.mods.fml.relauncher.SideOnly;
005import net.minecraft.client.model.ModelGhast;
006import net.minecraft.entity.EntityLiving;
007import net.minecraft.entity.monster.EntityGhast;
008import org.lwjgl.opengl.GL11;
009
010@SideOnly(Side.CLIENT)
011public class RenderGhast extends RenderLiving
012{
013    public RenderGhast()
014    {
015        super(new ModelGhast(), 0.5F);
016    }
017
018    /**
019     * Pre-Renders the Ghast.
020     */
021    protected void preRenderGhast(EntityGhast par1EntityGhast, float par2)
022    {
023        float f1 = ((float)par1EntityGhast.prevAttackCounter + (float)(par1EntityGhast.attackCounter - par1EntityGhast.prevAttackCounter) * par2) / 20.0F;
024
025        if (f1 < 0.0F)
026        {
027            f1 = 0.0F;
028        }
029
030        f1 = 1.0F / (f1 * f1 * f1 * f1 * f1 * 2.0F + 1.0F);
031        float f2 = (8.0F + f1) / 2.0F;
032        float f3 = (8.0F + 1.0F / f1) / 2.0F;
033        GL11.glScalef(f3, f2, f3);
034        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
035    }
036
037    /**
038     * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
039     * entityLiving, partialTickTime
040     */
041    protected void preRenderCallback(EntityLiving par1EntityLiving, float par2)
042    {
043        this.preRenderGhast((EntityGhast)par1EntityLiving, par2);
044    }
045}