protected virtual void Func_40280_a(EntityDragon par1EntityDragon, float par2, float par3, float par4, float par5, float par6, float par7) { if (par1EntityDragon.Field_40178_aA > 0) { float f = (float)par1EntityDragon.Field_40178_aA / 200F; //GL.DepthFunc(DepthFunction.Lequal); //GL.Enable(EnableCap.AlphaTest); //GL.AlphaFunc(AlphaFunction.Greater, f); LoadDownloadableImageTexture(par1EntityDragon.SkinUrl, "/mob/enderdragon/shuffle.png"); MainModel.Render(par1EntityDragon, par2, par3, par4, par5, par6, par7); //GL.AlphaFunc(AlphaFunction.Greater, 0.1F); //GL.DepthFunc(DepthFunction.Equal); } LoadDownloadableImageTexture(par1EntityDragon.SkinUrl, par1EntityDragon.GetTexture()); MainModel.Render(par1EntityDragon, par2, par3, par4, par5, par6, par7); if (par1EntityDragon.HurtTime > 0) { //GL.DepthFunc(DepthFunction.Equal); //GL.Disable(EnableCap.Texture2D); //GL.Enable(EnableCap.Blend); //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); //GL.Color4(1.0F, 0.0F, 0.0F, 0.5F); MainModel.Render(par1EntityDragon, par2, par3, par4, par5, par6, par7); //GL.Enable(EnableCap.Texture2D); //GL.Disable(EnableCap.Blend); //GL.DepthFunc(DepthFunction.Lequal); } }
protected virtual int Func_40283_a(EntityDragon par1EntityDragon, int par2, float par3) { if (par2 == 1) { //GL.DepthFunc(DepthFunction.Lequal); } if (par2 != 0) { return(-1); } else { LoadTexture("/mob/enderdragon/ender_eyes.png"); float f = 1.0F; //GL.Enable(EnableCap.Blend); //GL.Disable(EnableCap.AlphaTest); //GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One); //GL.Disable(EnableCap.Lighting); //GL.DepthFunc(DepthFunction.Equal); int i = 61680; int j = i % 0x10000; int k = i / 0x10000; OpenGlHelper.SetLightmapTextureCoords(OpenGlHelper.LightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F); //GL.Enable(EnableCap.Lighting); //GL.Color4(1.0F, 1.0F, 1.0F, f); return(1); } }
///<summary> /// Renders dragon's (boss) health on the HUD ///</summary> private void RenderBossHealth() { if (RenderDragon.EntityDragon == null) { return; } EntityDragon entitydragon = RenderDragon.EntityDragon; RenderDragon.EntityDragon = null; FontRendererOld fontrenderer = mc.FontRendererOld; ScaledResolution scaledresolution = new ScaledResolution(mc.GameSettings, mc.DisplayWidth, mc.DisplayHeight); int i = scaledresolution.GetScaledWidth(); int c = 266; int j = i / 2 - c / 2; int k = (int)(((float)entitydragon.Func_41010_ax() / (float)entitydragon.GetMaxHealth()) * (float)(c + 1)); byte byte0 = 12; DrawTexturedModalRect(j, byte0, 0, 74, c, 5); DrawTexturedModalRect(j, byte0, 0, 74, c, 5); if (k > 0) { DrawTexturedModalRect(j, byte0, 0, 79, k, 5); } string s = "Boss health"; fontrenderer.DrawStringWithShadow(s, i / 2 - fontrenderer.GetStringWidth(s) / 2, byte0 - 10, 0xff00ff); //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F); //GL.BindTexture(TextureTarget.Texture2D, mc.RenderEngineOld.GetTexture("/gui/icons.png")); }
/// <summary> /// Renders the animation for when an enderdragon dies /// </summary> protected virtual void RenderDragonDying(EntityDragon par1EntityDragon, float par2) { base.RenderEquippedItems(par1EntityDragon, par2); Tessellator tessellator = Tessellator.Instance; if (par1EntityDragon.Field_40178_aA > 0) { RenderHelper.DisableStandardItemLighting(); float f = ((float)par1EntityDragon.Field_40178_aA + par2) / 200F; float f1 = 0.0F; if (f > 0.8F) { f1 = (f - 0.8F) / 0.2F; } Random random = new Random(432); //GL.Disable(EnableCap.Texture2D); //GL.ShadeModel(ShadingModel.Smooth); //GL.Enable(EnableCap.Blend); //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.One); //GL.Disable(EnableCap.AlphaTest); //GL.Enable(EnableCap.CullFace); //GL.DepthMask(false); //GL.PushMatrix(); //GL.Translate(0.0F, -1F, -2F); for (int i = 0; (float)i < ((f + f * f) / 2.0F) * 60F; i++) { //GL.Rotate(random.NextDouble() * 360F, 1.0F, 0.0F, 0.0F); //GL.Rotate(random.NextDouble() * 360F, 0.0F, 1.0F, 0.0F); //GL.Rotate(random.NextDouble() * 360F, 0.0F, 0.0F, 1.0F); //GL.Rotate(random.NextDouble() * 360F, 1.0F, 0.0F, 0.0F); //GL.Rotate(random.NextDouble() * 360F, 0.0F, 1.0F, 0.0F); //GL.Rotate(random.NextDouble() * 360F + f * 90F, 0.0F, 0.0F, 1.0F); tessellator.StartDrawing(6); float f2 = (float)random.NextDouble() * 20F + 5F + f1 * 10F; float f3 = (float)random.NextDouble() * 2.0F + 1.0F + f1 * 2.0F; tessellator.SetColorRGBA_I(0xffffff, (int)(255F * (1.0F - f1))); tessellator.AddVertex(0.0F, 0.0F, 0.0F); tessellator.SetColorRGBA_I(0xff00ff, 0); tessellator.AddVertex(-0.86599999999999999D * (double)f3, f2, -0.5F * f3); tessellator.AddVertex(0.86599999999999999D * (double)f3, f2, -0.5F * f3); tessellator.AddVertex(0.0F, f2, 1.0F * f3); tessellator.AddVertex(-0.86599999999999999D * (double)f3, f2, -0.5F * f3); tessellator.Draw(); } //GL.PopMatrix(); //GL.DepthMask(true); //GL.Disable(EnableCap.CullFace); //GL.Disable(EnableCap.Blend); //GL.ShadeModel(ShadingModel.Flat); //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F); //GL.Enable(EnableCap.Texture2D); //GL.Enable(EnableCap.AlphaTest); RenderHelper.EnableStandardItemLighting(); } }
/// <summary> /// Renders the dragon, along with its dying animation /// </summary> public virtual void DoRenderDragon(EntityDragon par1EntityDragon, double par2, double par4, double par6, float par8, float par9) { EntityDragon = par1EntityDragon; if (Field_40284_d != 4) { MainModel = new ModelDragon(0.0F); Field_40284_d = 4; } base.DoRenderLiving(par1EntityDragon, par2, par4, par6, par8, par9); if (par1EntityDragon.HealingEnderCrystal != null) { float f = (float)par1EntityDragon.HealingEnderCrystal.InnerRotation + par9; float f1 = MathHelper2.Sin(f * 0.2F) / 2.0F + 0.5F; f1 = (f1 * f1 + f1) * 0.2F; float f2 = (float)(par1EntityDragon.HealingEnderCrystal.PosX - par1EntityDragon.PosX - (par1EntityDragon.PrevPosX - par1EntityDragon.PosX) * (double)(1.0F - par9)); float f3 = (float)(((double)f1 + par1EntityDragon.HealingEnderCrystal.PosY) - 1.0D - par1EntityDragon.PosY - (par1EntityDragon.PrevPosY - par1EntityDragon.PosY) * (double)(1.0F - par9)); float f4 = (float)(par1EntityDragon.HealingEnderCrystal.PosZ - par1EntityDragon.PosZ - (par1EntityDragon.PrevPosZ - par1EntityDragon.PosZ) * (double)(1.0F - par9)); float f5 = MathHelper2.Sqrt_float(f2 * f2 + f4 * f4); float f6 = MathHelper2.Sqrt_float(f2 * f2 + f3 * f3 + f4 * f4); //GL.PushMatrix(); //GL.Translate((float)par2, (float)par4 + 2.0F, (float)par6); //GL.Rotate(((float)(-Math.Atan2(f4, f2)) * 180F) / (float)Math.PI - 90F, 0.0F, 1.0F, 0.0F); //GL.Rotate(((float)(-Math.Atan2(f5, f3)) * 180F) / (float)Math.PI - 90F, 1.0F, 0.0F, 0.0F); Tessellator tessellator = Tessellator.Instance; RenderHelper.DisableStandardItemLighting(); //GL.Disable(EnableCap.CullFace); LoadTexture("/mob/enderdragon/beam.png"); //GL.ShadeModel(ShadingModel.Smooth); float f7 = 0.0F - ((float)par1EntityDragon.TicksExisted + par9) * 0.01F; float f8 = MathHelper2.Sqrt_float(f2 * f2 + f3 * f3 + f4 * f4) / 32F - ((float)par1EntityDragon.TicksExisted + par9) * 0.01F; tessellator.StartDrawing(5); int i = 8; for (int j = 0; j <= i; j++) { float f9 = MathHelper2.Sin(((float)(j % i) * (float)Math.PI * 2.0F) / (float)i) * 0.75F; float f10 = MathHelper2.Cos(((float)(j % i) * (float)Math.PI * 2.0F) / (float)i) * 0.75F; float f11 = ((float)(j % i) * 1.0F) / (float)i; tessellator.SetColorOpaque_I(0); tessellator.AddVertexWithUV(f9 * 0.2F, f10 * 0.2F, 0.0F, f11, f8); tessellator.SetColorOpaque_I(0xffffff); tessellator.AddVertexWithUV(f9, f10, f6, f11, f7); } tessellator.Draw(); //GL.Enable(EnableCap.CullFace); //GL.ShadeModel(ShadingModel.Flat); RenderHelper.EnableStandardItemLighting(); //GL.PopMatrix(); } }
/// <summary> /// Used to rotate the dragon as a whole in RenderDragon. It's called in the rotateCorpse method. /// </summary> protected virtual void RotateDragonBody(EntityDragon par1EntityDragon, float par2, float par3, float par4) { float f = (float)par1EntityDragon.Func_40160_a(7, par4)[0]; float f1 = (float)(par1EntityDragon.Func_40160_a(5, par4)[1] - par1EntityDragon.Func_40160_a(10, par4)[1]); //GL.Rotate(-f, 0.0F, 1.0F, 0.0F); //GL.Rotate(f1 * 10F, 1.0F, 0.0F, 0.0F); //GL.Translate(0.0F, 0.0F, 1.0F); if (par1EntityDragon.DeathTime > 0) { float f2 = ((((float)par1EntityDragon.DeathTime + par4) - 1.0F) / 20F) * 1.6F; f2 = MathHelper2.Sqrt_float(f2); if (f2 > 1.0F) { f2 = 1.0F; } //GL.Rotate(f2 * GetDeathMaxRotation(par1EntityDragon), 0.0F, 0.0F, 1.0F); } }
/// <summary> /// Sets the models various rotation angles then renders the model. /// </summary> public override void Render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) { //GL.PushMatrix(); EntityDragon entitydragon = (EntityDragon)par1Entity; float f = entitydragon.Field_40173_aw + (entitydragon.Field_40172_ax - entitydragon.Field_40173_aw) * Field_40317_s; Jaw.RotateAngleX = (float)(Math.Sin(f * (float)Math.PI * 2.0F) + 1.0D) * 0.2F; float f1 = (float)(Math.Sin(f * (float)Math.PI * 2.0F - 1.0F) + 1.0D); f1 = (f1 * f1 * 1.0F + f1 * 2.0F) * 0.05F; //GL.Translate(0.0F, f1 - 2.0F, -3F); //GL.Rotate(f1 * 2.0F, 1.0F, 0.0F, 0.0F); float f2 = -30F; float f4 = 0.0F; float f5 = 1.5F; float[] ad = entitydragon.Func_40160_a(6, Field_40317_s); float f6 = UpdateRotations(entitydragon.Func_40160_a(5, Field_40317_s)[0] - entitydragon.Func_40160_a(10, Field_40317_s)[0]); float f7 = UpdateRotations(entitydragon.Func_40160_a(5, Field_40317_s)[0] + (f6 / 2.0F)); f2 += 2.0F; float f8 = f * (float)Math.PI * 2.0F; f2 = 20F; float f3 = -12F; for (int i = 0; i < 5; i++) { float[] ad3 = entitydragon.Func_40160_a(5 - i, Field_40317_s); float f10 = (float)Math.Cos((float)i * 0.45F + f8) * 0.15F; Neck.RotateAngleY = ((UpdateRotations(ad3[0] - ad[0]) * (float)Math.PI) / 180F) * f5; Neck.RotateAngleX = f10 + (((float)(ad3[1] - ad[1]) * (float)Math.PI) / 180F) * f5 * 5F; Neck.RotateAngleZ = ((-UpdateRotations(ad3[0] - f7) * (float)Math.PI) / 180F) * f5; Neck.RotationPointY = f2; Neck.RotationPointZ = f3; Neck.RotationPointX = f4; f2 = (float)(f2 + Math.Sin(Neck.RotateAngleX) * 10); f3 = (float)(f3 - Math.Cos(Neck.RotateAngleY) * Math.Cos(Neck.RotateAngleX) * 10); f4 = (float)(f4 - Math.Sin(Neck.RotateAngleY) * Math.Cos(Neck.RotateAngleX) * 10); Neck.Render(par7); } Head.RotationPointY = f2; Head.RotationPointZ = f3; Head.RotationPointX = f4; float[] ad1 = entitydragon.Func_40160_a(0, Field_40317_s); Head.RotateAngleY = ((UpdateRotations(ad1[0] - ad[0]) * (float)Math.PI) / 180F) * 1.0F; Head.RotateAngleZ = ((-UpdateRotations(ad1[0] - f7) * (float)Math.PI) / 180F) * 1.0F; Head.Render(par7); //GL.PushMatrix(); //GL.Translate(0.0F, 1.0F, 0.0F); //GL.Rotate(-f6 * f5 * 1.0F, 0.0F, 0.0F, 1.0F); //GL.Translate(0.0F, -1F, 0.0F); Body.RotateAngleZ = 0.0F; Body.Render(par7); for (int j = 0; j < 2; j++) { //GL.Enable(EnableCap.CullFace); float f11 = f * (float)Math.PI * 2.0F; Wing.RotateAngleX = 0.125F - (float)Math.Cos(f11) * 0.2F; Wing.RotateAngleY = 0.25F; Wing.RotateAngleZ = (float)(Math.Sin(f11) + 0.125D) * 0.8F; WingTip.RotateAngleZ = -(float)(Math.Sin(f11 + 2.0F) + 0.5D) * 0.75F; RearLeg.RotateAngleX = 1.0F + f1 * 0.1F; RearLegTip.RotateAngleX = 0.5F + f1 * 0.1F; RearFoot.RotateAngleX = 0.75F + f1 * 0.1F; FrontLeg.RotateAngleX = 1.3F + f1 * 0.1F; FrontLegTip.RotateAngleX = -0.5F - f1 * 0.1F; FrontFoot.RotateAngleX = 0.75F + f1 * 0.1F; Wing.Render(par7); FrontLeg.Render(par7); RearLeg.Render(par7); //GL.Scale(-1F, 1.0F, 1.0F); if (j == 0) { //GL.CullFace(CullFaceMode.Front); } } //GL.PopMatrix(); //GL.CullFace(CullFaceMode.Back); //GL.Disable(EnableCap.CullFace); float f9 = -(float)Math.Sin(f * (float)Math.PI * 2.0F) * 0.0F; f8 = f * (float)Math.PI * 2.0F; f2 = 10F; f3 = 60F; f4 = 0.0F; ad = entitydragon.Func_40160_a(11, Field_40317_s); for (int k = 0; k < 12; k++) { float[] ad2 = entitydragon.Func_40160_a(12 + k, Field_40317_s); f9 = (float)((double)f9 + Math.Sin((float)k * 0.45F + f8) * 0.05000000074505806D); Neck.RotateAngleY = ((UpdateRotations(ad2[0] - ad[0]) * f5 + 180F) * (float)Math.PI) / 180F; Neck.RotateAngleX = f9 + (((float)(ad2[1] - ad[1]) * (float)Math.PI) / 180F) * f5 * 5F; Neck.RotateAngleZ = ((UpdateRotations(ad2[0] - (double)f7) * (float)Math.PI) / 180F) * f5; Neck.RotationPointY = f2; Neck.RotationPointZ = f3; Neck.RotationPointX = f4; f2 = (float)(f2 + Math.Sin(Neck.RotateAngleX) * 10D); f3 = (float)(f3 - Math.Cos(Neck.RotateAngleY) * Math.Cos(Neck.RotateAngleX) * 10D); f4 = (float)(f4 - Math.Sin(Neck.RotateAngleY) * Math.Cos(Neck.RotateAngleX) * 10D); Neck.Render(par7); } //GL.PopMatrix(); }