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.ModelGhast;
006 import net.minecraft.entity.EntityLiving;
007 import net.minecraft.entity.monster.EntityGhast;
008 import org.lwjgl.opengl.GL11;
009
010 @SideOnly(Side.CLIENT)
011 public 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 var4 = ((float)par1EntityGhast.prevAttackCounter + (float)(par1EntityGhast.attackCounter - par1EntityGhast.prevAttackCounter) * par2) / 20.0F;
024
025 if (var4 < 0.0F)
026 {
027 var4 = 0.0F;
028 }
029
030 var4 = 1.0F / (var4 * var4 * var4 * var4 * var4 * 2.0F + 1.0F);
031 float var5 = (8.0F + var4) / 2.0F;
032 float var6 = (8.0F + 1.0F / var4) / 2.0F;
033 GL11.glScalef(var6, var5, var6);
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 }