/// <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> /// Actually renders the lightning bolt. This method is called through the doRender method. /// </summary> public virtual void DoRenderLightningBolt(EntityLightningBolt par1EntityLightningBolt, double par2, double par4, double par6, float par8, float par9) { Tessellator tessellator = Tessellator.Instance; //GL.Disable(EnableCap.Texture2D); //GL.Disable(EnableCap.Lighting); //GL.Enable(EnableCap.Blend); //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.One); double[] ad = new double[8]; double[] ad1 = new double[8]; double d = 0.0F; double d1 = 0.0F; Random random = new Random((int)par1EntityLightningBolt.BoltVertex); for (int j = 7; j >= 0; j--) { ad[j] = d; ad1[j] = d1; d += random.Next(11) - 5; d1 += random.Next(11) - 5; } for (int i = 0; i < 4; i++) { Random random1 = new Random((int)par1EntityLightningBolt.BoltVertex); for (int k = 0; k < 3; k++) { int l = 7; int i1 = 0; if (k > 0) { l = 7 - k; } if (k > 0) { i1 = l - 2; } double d2 = ad[l] - d; double d3 = ad1[l] - d1; for (int j1 = l; j1 >= i1; j1--) { double d4 = d2; double d5 = d3; if (k == 0) { d2 += random1.Next(11) - 5; d3 += random1.Next(11) - 5; } else { d2 += random1.Next(31) - 15; d3 += random1.Next(31) - 15; } tessellator.StartDrawing(5); float f = 0.5F; tessellator.SetColorRGBA_F(0.9F * f, 0.9F * f, 1.0F * f, 0.3F); double d6 = 0.10000000000000001D + (double)i * 0.20000000000000001D; if (k == 0) { d6 *= (double)j1 * 0.10000000000000001D + 1.0D; } double d7 = 0.10000000000000001D + (double)i * 0.20000000000000001D; if (k == 0) { d7 *= (double)(j1 - 1) * 0.10000000000000001D + 1.0D; } for (int k1 = 0; k1 < 5; k1++) { double d8 = (par2 + 0.5D) - d6; double d9 = (par6 + 0.5D) - d6; if (k1 == 1 || k1 == 2) { d8 += d6 * 2D; } if (k1 == 2 || k1 == 3) { d9 += d6 * 2D; } double d10 = (par2 + 0.5D) - d7; double d11 = (par6 + 0.5D) - d7; if (k1 == 1 || k1 == 2) { d10 += d7 * 2D; } if (k1 == 2 || k1 == 3) { d11 += d7 * 2D; } tessellator.AddVertex(d10 + d2, par4 + (double)(j1 * 16), d11 + d3); tessellator.AddVertex(d8 + d4, par4 + (double)((j1 + 1) * 16), d9 + d5); } tessellator.Draw(); } } } //GL.Disable(EnableCap.Blend); //GL.Enable(EnableCap.Lighting); //GL.Enable(EnableCap.Texture2D); }
/// <summary> /// Actually renders the fishing line and hook /// </summary> public virtual void DoRenderFishHook(EntityFishHook par1EntityFishHook, double par2, double par4, double par6, float par8, float par9) { //GL.PushMatrix(); //GL.Translate((float)par2, (float)par4, (float)par6); //GL.Enable(EnableCap.RescaleNormal); //GL.Scale(0.5F, 0.5F, 0.5F); int i = 1; sbyte byte0 = 2; LoadTexture("/particles.png"); Tessellator tessellator = Tessellator.Instance; float f = (float)(i * 8 + 0) / 128F; float f1 = (float)(i * 8 + 8) / 128F; float f2 = (float)(byte0 * 8 + 0) / 128F; float f3 = (float)(byte0 * 8 + 8) / 128F; float f4 = 1.0F; float f5 = 0.5F; float f6 = 0.5F; //GL.Rotate(180F - RenderManager.PlayerViewY, 0.0F, 1.0F, 0.0F); //GL.Rotate(-RenderManager.PlayerViewX, 1.0F, 0.0F, 0.0F); tessellator.StartDrawingQuads(); tessellator.SetNormal(0.0F, 1.0F, 0.0F); tessellator.AddVertexWithUV(0.0F - f5, 0.0F - f6, 0.0F, f, f3); tessellator.AddVertexWithUV(f4 - f5, 0.0F - f6, 0.0F, f1, f3); tessellator.AddVertexWithUV(f4 - f5, 1.0F - f6, 0.0F, f1, f2); tessellator.AddVertexWithUV(0.0F - f5, 1.0F - f6, 0.0F, f, f2); tessellator.Draw(); //GL.Disable(EnableCap.RescaleNormal); //GL.PopMatrix(); if (par1EntityFishHook.Angler != null) { float f7 = ((par1EntityFishHook.Angler.PrevRotationYaw + (par1EntityFishHook.Angler.RotationYaw - par1EntityFishHook.Angler.PrevRotationYaw) * par9) * (float)Math.PI) / 180F; double d = MathHelper2.Sin(f7); double d2 = MathHelper2.Cos(f7); float f9 = par1EntityFishHook.Angler.GetSwingProgress(par9); float f10 = MathHelper2.Sin(MathHelper2.Sqrt_float(f9) * (float)Math.PI); Vec3D vec3d = Vec3D.CreateVector(-0.5D, 0.029999999999999999D, 0.80000000000000004D); vec3d.RotateAroundX((-(par1EntityFishHook.Angler.PrevRotationPitch + (par1EntityFishHook.Angler.RotationPitch - par1EntityFishHook.Angler.PrevRotationPitch) * par9) * (float)Math.PI) / 180F); vec3d.RotateAroundY((-(par1EntityFishHook.Angler.PrevRotationYaw + (par1EntityFishHook.Angler.RotationYaw - par1EntityFishHook.Angler.PrevRotationYaw) * par9) * (float)Math.PI) / 180F); vec3d.RotateAroundY(f10 * 0.5F); vec3d.RotateAroundX(-f10 * 0.7F); double d4 = par1EntityFishHook.Angler.PrevPosX + (par1EntityFishHook.Angler.PosX - par1EntityFishHook.Angler.PrevPosX) * (double)par9 + vec3d.XCoord; double d5 = par1EntityFishHook.Angler.PrevPosY + (par1EntityFishHook.Angler.PosY - par1EntityFishHook.Angler.PrevPosY) * (double)par9 + vec3d.YCoord; double d6 = par1EntityFishHook.Angler.PrevPosZ + (par1EntityFishHook.Angler.PosZ - par1EntityFishHook.Angler.PrevPosZ) * (double)par9 + vec3d.ZCoord; if (RenderManager.Options.ThirdPersonView > 0) { float f8 = ((par1EntityFishHook.Angler.PrevRenderYawOffset + (par1EntityFishHook.Angler.RenderYawOffset - par1EntityFishHook.Angler.PrevRenderYawOffset) * par9) * (float)Math.PI) / 180F; double d1 = MathHelper2.Sin(f8); double d3 = MathHelper2.Cos(f8); d4 = (par1EntityFishHook.Angler.PrevPosX + (par1EntityFishHook.Angler.PosX - par1EntityFishHook.Angler.PrevPosX) * (double)par9) - d3 * 0.34999999999999998D - d1 * 0.84999999999999998D; d5 = (par1EntityFishHook.Angler.PrevPosY + (par1EntityFishHook.Angler.PosY - par1EntityFishHook.Angler.PrevPosY) * (double)par9) - 0.45000000000000001D; d6 = ((par1EntityFishHook.Angler.PrevPosZ + (par1EntityFishHook.Angler.PosZ - par1EntityFishHook.Angler.PrevPosZ) * (double)par9) - d1 * 0.34999999999999998D) + d3 * 0.84999999999999998D; } double d7 = par1EntityFishHook.PrevPosX + (par1EntityFishHook.PosX - par1EntityFishHook.PrevPosX) * (double)par9; double d8 = par1EntityFishHook.PrevPosY + (par1EntityFishHook.PosY - par1EntityFishHook.PrevPosY) * (double)par9 + 0.25D; double d9 = par1EntityFishHook.PrevPosZ + (par1EntityFishHook.PosZ - par1EntityFishHook.PrevPosZ) * (double)par9; double d10 = (float)(d4 - d7); double d11 = (float)(d5 - d8); double d12 = (float)(d6 - d9); //GL.Disable(EnableCap.Texture2D); //GL.Disable(EnableCap.Lighting); tessellator.StartDrawing(3); tessellator.SetColorOpaque_I(0); int j = 16; for (int k = 0; k <= j; k++) { float f11 = (float)k / (float)j; tessellator.AddVertex(par2 + d10 * (double)f11, par4 + d11 * (double)(f11 * f11 + f11) * 0.5D + 0.25D, par6 + d12 * (double)f11); } tessellator.Draw(); //GL.Enable(EnableCap.Lighting); //GL.Enable(EnableCap.Texture2D); } }