/// <summary> /// Returns the linear distance to another path point /// </summary> public virtual float DistanceTo(PathPoint par1PathPoint) { float f = par1PathPoint.XCoord - XCoord; float f1 = par1PathPoint.YCoord - YCoord; float f2 = par1PathPoint.ZCoord - ZCoord; return MathHelper2.Sqrt_float(f * f + f1 * f1 + f2 * f2); }
/// <summary> /// Normalize the frustum. /// </summary> private void Normalize(float[][] par1ArrayOfFloat, int par2) { float f = MathHelper2.Sqrt_float(par1ArrayOfFloat[par2][0] * par1ArrayOfFloat[par2][0] + par1ArrayOfFloat[par2][1] * par1ArrayOfFloat[par2][1] + par1ArrayOfFloat[par2][2] * par1ArrayOfFloat[par2][2]); par1ArrayOfFloat[par2][0] /= f; par1ArrayOfFloat[par2][1] /= f; par1ArrayOfFloat[par2][2] /= f; par1ArrayOfFloat[par2][3] /= f; }
/// <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> /// Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack. /// </summary> protected override void AttackEntity(Entity par1Entity, float par2) { if (AttackTime <= 0 && par2 < 2.0F && par1Entity.BoundingBox.MaxY > BoundingBox.MinY && par1Entity.BoundingBox.MinY < BoundingBox.MaxY) { AttackTime = 20; AttackEntityAsMob(par1Entity); } else if (par2 < 30F) { float d = par1Entity.PosX - PosX; float d1 = (par1Entity.BoundingBox.MinY + (par1Entity.Height / 2.0F)) - (PosY + (Height / 2.0F)); float d2 = par1Entity.PosZ - PosZ; if (AttackTime == 0) { Field_40152_d++; if (Field_40152_d == 1) { AttackTime = 60; Func_40150_a(true); } else if (Field_40152_d <= 4) { AttackTime = 6; } else { AttackTime = 100; Field_40152_d = 0; Func_40150_a(false); } if (Field_40152_d > 1) { float f = MathHelper2.Sqrt_float(par2) * 0.5F; WorldObj.PlayAuxSFXAtEntity(null, 1009, (int)PosX, (int)PosY, (int)PosZ, 0); for (int i = 0; i < 1; i++) { EntitySmallFireball entitysmallfireball = new EntitySmallFireball(WorldObj, this, d + Rand.NextGaussian() * f, d1, d2 + Rand.NextGaussian() * f); entitysmallfireball.PosY = PosY + (Height / 2.0F) + 0.5F; WorldObj.SpawnEntityInWorld(entitysmallfireball); } } } RotationYaw = (float)((Math.Atan2(d2, d) * 180D) / Math.PI) - 90F; HasAttacked = true; } }
protected virtual void RotateCorpse(EntityLiving par1EntityLiving, float par2, float par3, float par4) { //GL.Rotate(180F - par3, 0.0F, 1.0F, 0.0F); if (par1EntityLiving.DeathTime > 0) { float f = ((((float)par1EntityLiving.DeathTime + par4) - 1.0F) / 20F) * 1.6F; f = MathHelper2.Sqrt_float(f); if (f > 1.0F) { f = 1.0F; } //GL.Rotate(f * GetDeathMaxRotation(par1EntityLiving), 0.0F, 0.0F, 1.0F); } }
/// <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> /// generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the /// size. ///</summary> private double[] InitializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) { if (par1ArrayOfDouble == null) { par1ArrayOfDouble = new double[par5 * par6 * par7]; } if (Field_35388_l == null) { Field_35388_l = new float[25]; for (int i = -2; i <= 2; i++) { for (int j = -2; j <= 2; j++) { float f = 10F / MathHelper2.Sqrt_float((float)(i * i + j * j) + 0.2F); Field_35388_l[i + 2 + (j + 2) * 5] = f; } } } double d = 684.41200000000003D; double d1 = 684.41200000000003D; Noise5 = NoiseGen5.GenerateNoiseOctaves(Noise5, par2, par4, par5, par7, 1.121D, 1.121D, 0.5D); Noise6 = NoiseGen6.GenerateNoiseOctaves(Noise6, par2, par4, par5, par7, 200D, 200D, 0.5D); Noise3 = noiseGen3.GenerateNoiseOctaves(Noise3, par2, par3, par4, par5, par6, par7, d / 80D, d1 / 160D, d / 80D); Noise1 = noiseGen1.GenerateNoiseOctaves(Noise1, par2, par3, par4, par5, par6, par7, d, d1, d); Noise2 = noiseGen2.GenerateNoiseOctaves(Noise2, par2, par3, par4, par5, par6, par7, d, d1, d); par2 = par4 = 0; int k = 0; int l = 0; for (int i1 = 0; i1 < par5; i1++) { for (int j1 = 0; j1 < par7; j1++) { float f1 = 0.0F; float f2 = 0.0F; float f3 = 0.0F; byte byte0 = 2; BiomeGenBase biomegenbase = biomesForGeneration[i1 + 2 + (j1 + 2) * (par5 + 5)]; for (int k1 = -byte0; k1 <= byte0; k1++) { for (int l1 = -byte0; l1 <= byte0; l1++) { BiomeGenBase biomegenbase1 = biomesForGeneration[i1 + k1 + 2 + (j1 + l1 + 2) * (par5 + 5)]; float f4 = Field_35388_l[k1 + 2 + (l1 + 2) * 5] / (biomegenbase1.MinHeight + 2.0F); if (biomegenbase1.MinHeight > biomegenbase.MinHeight) { f4 /= 2.0F; } f1 += biomegenbase1.MaxHeight * f4; f2 += biomegenbase1.MinHeight * f4; f3 += f4; } } f1 /= f3; f2 /= f3; f1 = f1 * 0.9F + 0.1F; f2 = (f2 * 4F - 1.0F) / 8F; double d2 = Noise6[l] / 8000D; if (d2 < 0.0F) { d2 = -d2 * 0.29999999999999999D; } d2 = d2 * 3D - 2D; if (d2 < 0.0F) { d2 /= 2D; if (d2 < -1D) { d2 = -1D; } d2 /= 1.3999999999999999D; d2 /= 2D; } else { if (d2 > 1.0D) { d2 = 1.0D; } d2 /= 8D; } l++; for (int i2 = 0; i2 < par6; i2++) { double d3 = f2; double d4 = f1; d3 += d2 * 0.20000000000000001D; d3 = (d3 * (double)par6) / 16D; double d5 = (double)par6 / 2D + d3 * 4D; double d6 = 0.0F; double d7 = (((double)i2 - d5) * 12D * 128D) / 128D / d4; if (d7 < 0.0F) { d7 *= 4D; } double d8 = Noise1[k] / 512D; double d9 = Noise2[k] / 512D; double d10 = (Noise3[k] / 10D + 1.0D) / 2D; if (d10 < 0.0F) { d6 = d8; } else if (d10 > 1.0D) { d6 = d9; } else { d6 = d8 + (d9 - d8) * d10; } d6 -= d7; if (i2 > par6 - 4) { double d11 = (float)(i2 - (par6 - 4)) / 3F; d6 = d6 * (1.0D - d11) + -10D * d11; } par1ArrayOfDouble[k] = d6; k++; } } } return(par1ArrayOfDouble); }
/// <summary> /// Renders the active item in the player's hand when in first person mode. Args: partialTickTime /// </summary> public virtual void RenderItemInFirstPerson(float par1) { float f = PrevEquippedProgress + (EquippedProgress - PrevEquippedProgress) * par1; EntityPlayerSP entityplayersp = Mc.ThePlayer; float f1 = ((EntityPlayer)(entityplayersp)).PrevRotationPitch + (((EntityPlayer)(entityplayersp)).RotationPitch - ((EntityPlayer)(entityplayersp)).PrevRotationPitch) * par1; //GL.PushMatrix(); //GL.Rotate(f1, 1.0F, 0.0F, 0.0F); //GL.Rotate(((EntityPlayer)(entityplayersp)).PrevRotationYaw + (((EntityPlayer)(entityplayersp)).RotationYaw - ((EntityPlayer)(entityplayersp)).PrevRotationYaw) * par1, 0.0F, 1.0F, 0.0F); RenderHelper.EnableStandardItemLighting(); //GL.PopMatrix(); if (entityplayersp is EntityPlayerSP) { EntityPlayerSP entityplayersp1 = (EntityPlayerSP)entityplayersp; float f2 = entityplayersp1.PrevRenderArmPitch + (entityplayersp1.RenderArmPitch - entityplayersp1.PrevRenderArmPitch) * par1; float f4 = entityplayersp1.PrevRenderArmYaw + (entityplayersp1.RenderArmYaw - entityplayersp1.PrevRenderArmYaw) * par1; //GL.Rotate((((EntityPlayer)(entityplayersp)).RotationPitch - f2) * 0.1F, 1.0F, 0.0F, 0.0F); //GL.Rotate((((EntityPlayer)(entityplayersp)).RotationYaw - f4) * 0.1F, 0.0F, 1.0F, 0.0F); } ItemStack itemstack = ItemToRender; float f3 = Mc.TheWorld.GetLightBrightness(MathHelper2.Floor_double(((EntityPlayer)(entityplayersp)).PosX), MathHelper2.Floor_double(((EntityPlayer)(entityplayersp)).PosY), MathHelper2.Floor_double(((EntityPlayer)(entityplayersp)).PosZ)); f3 = 1.0F; int i = Mc.TheWorld.GetLightBrightnessForSkyBlocks(MathHelper2.Floor_double(((EntityPlayer)(entityplayersp)).PosX), MathHelper2.Floor_double(((EntityPlayer)(entityplayersp)).PosY), MathHelper2.Floor_double(((EntityPlayer)(entityplayersp)).PosZ), 0); int k = i % 0x10000; int l = i / 0x10000; OpenGlHelper.SetLightmapTextureCoords(OpenGlHelper.LightmapTexUnit, (float)k / 1.0F, (float)l / 1.0F); //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F); if (itemstack != null) { int j = Item.ItemsList[itemstack.ItemID].GetColorFromDamage(itemstack.GetItemDamage(), 0); float f8 = (float)(j >> 16 & 0xff) / 255F; float f13 = (float)(j >> 8 & 0xff) / 255F; float f19 = (float)(j & 0xff) / 255F; //GL.Color4(f3 * f8, f3 * f13, f3 * f19, 1.0F); } else { //GL.Color4(f3, f3, f3, 1.0F); } if (itemstack != null && itemstack.ItemID == Item.Map.ShiftedIndex) { //GL.PushMatrix(); // float f5 = 0.8F; float f9 = entityplayersp.GetSwingProgress(par1); float f14 = MathHelper2.Sin(f9 * (float)Math.PI); float f20 = MathHelper2.Sin(MathHelper2.Sqrt_float(f9) * (float)Math.PI); //GL.Translate(-f20 * 0.4F, MathHelper.Sin(MathHelper.Sqrt_float(f9) * (float)Math.PI * 2.0F) * 0.2F, -f14 * 0.2F); f9 = (1.0F - f1 / 45F) + 0.1F; if (f9 < 0.0F) { f9 = 0.0F; } if (f9 > 1.0F) { f9 = 1.0F; } f9 = -MathHelper2.Cos(f9 * (float)Math.PI) * 0.5F + 0.5F; //GL.Translate(0.0F, (0.0F * f5 - (1.0F - f) * 1.2F - f9 * 0.5F) + 0.04F, -0.9F * f5); //GL.Rotate(90F, 0.0F, 1.0F, 0.0F); //GL.Rotate(f9 * -85F, 0.0F, 0.0F, 1.0F); //GL.Enable(EnableCap.RescaleNormal); //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTextureForDownloadableImage(Mc.ThePlayer.SkinUrl, Mc.ThePlayer.GetTexture())); for (f14 = 0; f14 < 2; f14++) { f20 = f14 * 2 - 1; //GL.PushMatrix(); //GL.Translate(-0F, -0.6F, 1.1F * (float)f20); //GL.Rotate(-45 * f20, 1.0F, 0.0F, 0.0F); //GL.Rotate(-90F, 0.0F, 0.0F, 1.0F); //GL.Rotate(59F, 0.0F, 0.0F, 1.0F); //GL.Rotate(-65 * f20, 0.0F, 1.0F, 0.0F); Render render1 = RenderManager.Instance.GetEntityRenderObject(Mc.ThePlayer); RenderPlayer renderplayer1 = (RenderPlayer)render1; // float f34 = 1.0F; //GL.Scale(f34, f34, f34); renderplayer1.DrawFirstPersonHand(); //GL.PopMatrix(); } f14 = entityplayersp.GetSwingProgress(par1); f20 = MathHelper2.Sin(f14 * f14 * (float)Math.PI); float f27 = MathHelper2.Sin(MathHelper2.Sqrt_float(f14) * (float)Math.PI); //GL.Rotate(-f20 * 20F, 0.0F, 1.0F, 0.0F); //GL.Rotate(-f27 * 20F, 0.0F, 0.0F, 1.0F); //GL.Rotate(-f27 * 80F, 1.0F, 0.0F, 0.0F); f14 = 0.38F; //GL.Scale(f14, f14, f14); //GL.Rotate(90F, 0.0F, 1.0F, 0.0F); //GL.Rotate(180F, 0.0F, 0.0F, 1.0F); //GL.Translate(-1F, -1F, 0.0F); f20 = 0.015625F; //GL.Scale(f20, f20, f20); Mc.RenderEngineOld.BindTexture(Mc.RenderEngineOld.GetTexture("/misc/mapbg.png")); Tessellator tessellator = Tessellator.Instance; //GL.Normal3(0.0F, 0.0F, -1F); tessellator.StartDrawingQuads(); sbyte byte0 = 7; tessellator.AddVertexWithUV(0 - byte0, 128 + byte0, 0.0F, 0.0F, 1.0D); tessellator.AddVertexWithUV(128 + byte0, 128 + byte0, 0.0F, 1.0D, 1.0D); tessellator.AddVertexWithUV(128 + byte0, 0 - byte0, 0.0F, 1.0D, 0.0F); tessellator.AddVertexWithUV(0 - byte0, 0 - byte0, 0.0F, 0.0F, 0.0F); tessellator.Draw(); MapData mapdata = Item.Map.GetMapData(itemstack, Mc.TheWorld); MapItemRenderer.RenderMap(Mc.ThePlayer, Mc.RenderEngineOld, mapdata); //GL.PopMatrix(); } else if (itemstack != null) { //GL.PushMatrix(); // float f6 = 0.8F; if (entityplayersp.GetItemInUseCount() > 0) { EnumAction enumaction = itemstack.GetItemUseAction(); if (enumaction == EnumAction.Eat || enumaction == EnumAction.Drink) { float f15 = ((float)entityplayersp.GetItemInUseCount() - par1) + 1.0F; float f21 = 1.0F - f15 / (float)itemstack.GetMaxItemUseDuration(); float f28 = f21; float f31 = 1.0F - f28; f31 = f31 * f31 * f31; f31 = f31 * f31 * f31; f31 = f31 * f31 * f31; float f35 = 1.0F - f31; //GL.Translate(0.0F, MathHelper.Abs(MathHelper.Cos((f15 / 4F) * (float)Math.PI) * 0.1F) * (float)((double)f28 <= 0.20000000000000001D ? 0 : 1), 0.0F); //GL.Translate(f35 * 0.6F, -f35 * 0.5F, 0.0F); //GL.Rotate(f35 * 90F, 0.0F, 1.0F, 0.0F); //GL.Rotate(f35 * 10F, 1.0F, 0.0F, 0.0F); //GL.Rotate(f35 * 30F, 0.0F, 0.0F, 1.0F); } } else { float f10 = entityplayersp.GetSwingProgress(par1); float f16 = MathHelper2.Sin(f10 * (float)Math.PI); float f22 = MathHelper2.Sin(MathHelper2.Sqrt_float(f10) * (float)Math.PI); //GL.Translate(-f22 * 0.4F, MathHelper.Sin(MathHelper.Sqrt_float(f10) * (float)Math.PI * 2.0F) * 0.2F, -f16 * 0.2F); } //GL.Translate(0.7F * f6, -0.65F * f6 - (1.0F - f) * 0.6F, -0.9F * f6); //GL.Rotate(45F, 0.0F, 1.0F, 0.0F); //GL.Enable(EnableCap.RescaleNormal); float f11 = entityplayersp.GetSwingProgress(par1); float f17 = MathHelper2.Sin(f11 * f11 * (float)Math.PI); float f23 = MathHelper2.Sin(MathHelper2.Sqrt_float(f11) * (float)Math.PI); //GL.Rotate(-f17 * 20F, 0.0F, 1.0F, 0.0F); //GL.Rotate(-f23 * 20F, 0.0F, 0.0F, 1.0F); //GL.Rotate(-f23 * 80F, 1.0F, 0.0F, 0.0F); f11 = 0.4F; //GL.Scale(f11, f11, f11); if (entityplayersp.GetItemInUseCount() > 0) { EnumAction enumaction1 = itemstack.GetItemUseAction(); if (enumaction1 == EnumAction.Block) { //GL.Translate(-0.5F, 0.2F, 0.0F); //GL.Rotate(30F, 0.0F, 1.0F, 0.0F); //GL.Rotate(-80F, 1.0F, 0.0F, 0.0F); //GL.Rotate(60F, 0.0F, 1.0F, 0.0F); } else if (enumaction1 == EnumAction.Bow) { //GL.Rotate(-18F, 0.0F, 0.0F, 1.0F); //GL.Rotate(-12F, 0.0F, 1.0F, 0.0F); //GL.Rotate(-8F, 1.0F, 0.0F, 0.0F); //GL.Translate(-0.9F, 0.2F, 0.0F); float f24 = (float)itemstack.GetMaxItemUseDuration() - (((float)entityplayersp.GetItemInUseCount() - par1) + 1.0F); float f29 = f24 / 20F; f29 = (f29 * f29 + f29 * 2.0F) / 3F; if (f29 > 1.0F) { f29 = 1.0F; } if (f29 > 0.1F) { //GL.Translate(0.0F, MathHelper.Sin((f24 - 0.1F) * 1.3F) * 0.01F * (f29 - 0.1F), 0.0F); } //GL.Translate(0.0F, 0.0F, f29 * 0.1F); //GL.Rotate(-335F, 0.0F, 0.0F, 1.0F); //GL.Rotate(-50F, 0.0F, 1.0F, 0.0F); //GL.Translate(0.0F, 0.5F, 0.0F); float f32 = 1.0F + f29 * 0.2F; //GL.Scale(1.0F, 1.0F, f32); //GL.Translate(0.0F, -0.5F, 0.0F); //GL.Rotate(50F, 0.0F, 1.0F, 0.0F); //GL.Rotate(335F, 0.0F, 0.0F, 1.0F); } } if (itemstack.GetItem().ShouldRotateAroundWhenRendering()) { //GL.Rotate(180F, 0.0F, 1.0F, 0.0F); } if (itemstack.GetItem().Func_46058_c()) { RenderItem(entityplayersp, itemstack, 0); int i1 = Item.ItemsList[itemstack.ItemID].GetColorFromDamage(itemstack.GetItemDamage(), 1); float f25 = (float)(i1 >> 16 & 0xff) / 255F; float f30 = (float)(i1 >> 8 & 0xff) / 255F; float f33 = (float)(i1 & 0xff) / 255F; //GL.Color4(f3 * f25, f3 * f30, f3 * f33, 1.0F); RenderItem(entityplayersp, itemstack, 1); } else { RenderItem(entityplayersp, itemstack, 0); } //GL.PopMatrix(); } else { //GL.PushMatrix(); // float f7 = 0.8F; float f12 = entityplayersp.GetSwingProgress(par1); float f18 = MathHelper2.Sin(f12 * (float)Math.PI); float f26 = MathHelper2.Sin(MathHelper2.Sqrt_float(f12) * (float)Math.PI); //GL.Translate(-f26 * 0.3F, MathHelper.Sin(MathHelper.Sqrt_float(f12) * (float)Math.PI * 2.0F) * 0.4F, -f18 * 0.4F); //GL.Translate(0.8F * f7, -0.75F * f7 - (1.0F - f) * 0.6F, -0.9F * f7); //GL.Rotate(45F, 0.0F, 1.0F, 0.0F); //GL.Enable(EnableCap.RescaleNormal); f12 = entityplayersp.GetSwingProgress(par1); f18 = MathHelper2.Sin(f12 * f12 * (float)Math.PI); f26 = MathHelper2.Sin(MathHelper2.Sqrt_float(f12) * (float)Math.PI); //GL.Rotate(f26 * 70F, 0.0F, 1.0F, 0.0F); //GL.Rotate(-f18 * 20F, 0.0F, 0.0F, 1.0F); //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTextureForDownloadableImage(Mc.ThePlayer.SkinUrl, Mc.ThePlayer.GetTexture())); //GL.Translate(-1F, 3.6F, 3.5F); //GL.Rotate(120F, 0.0F, 0.0F, 1.0F); //GL.Rotate(200F, 1.0F, 0.0F, 0.0F); //GL.Rotate(-135F, 0.0F, 1.0F, 0.0F); //GL.Scale(1.0F, 1.0F, 1.0F); //GL.Translate(5.6F, 0.0F, 0.0F); Render render = RenderManager.Instance.GetEntityRenderObject(Mc.ThePlayer); RenderPlayer renderplayer = (RenderPlayer)render; f26 = 1.0F; //GL.Scale(f26, f26, f26); renderplayer.DrawFirstPersonHand(); //GL.PopMatrix(); } //GL.Disable(EnableCap.RescaleNormal); RenderHelper.DisableStandardItemLighting(); }
/// <summary> /// Sets the models various rotation angles. /// </summary> public override void SetRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6) { BipedHead.RotateAngleY = par4 / (180F / (float)Math.PI); BipedHead.RotateAngleX = par5 / (180F / (float)Math.PI); BipedHeadwear.RotateAngleY = BipedHead.RotateAngleY; BipedHeadwear.RotateAngleX = BipedHead.RotateAngleX; BipedRightArm.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F + (float)Math.PI) * 2.0F * par2 * 0.5F; BipedLeftArm.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F) * 2.0F * par2 * 0.5F; BipedRightArm.RotateAngleZ = 0.0F; BipedLeftArm.RotateAngleZ = 0.0F; BipedRightLeg.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F) * 1.4F * par2; BipedLeftLeg.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2; BipedRightLeg.RotateAngleY = 0.0F; BipedLeftLeg.RotateAngleY = 0.0F; if (IsRiding) { BipedRightArm.RotateAngleX += -((float)Math.PI / 5F); BipedLeftArm.RotateAngleX += -((float)Math.PI / 5F); BipedRightLeg.RotateAngleX = -((float)Math.PI * 2F / 5F); BipedLeftLeg.RotateAngleX = -((float)Math.PI * 2F / 5F); BipedRightLeg.RotateAngleY = ((float)Math.PI / 10F); BipedLeftLeg.RotateAngleY = -((float)Math.PI / 10F); } if (HeldItemLeft != 0) { BipedLeftArm.RotateAngleX = BipedLeftArm.RotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)HeldItemLeft; } if (HeldItemRight != 0) { BipedRightArm.RotateAngleX = BipedRightArm.RotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)HeldItemRight; } BipedRightArm.RotateAngleY = 0.0F; BipedLeftArm.RotateAngleY = 0.0F; if (OnGround > -9990F) { float f = OnGround; BipedBody.RotateAngleY = MathHelper2.Sin(MathHelper2.Sqrt_float(f) * (float)Math.PI * 2.0F) * 0.2F; BipedRightArm.RotationPointZ = MathHelper2.Sin(BipedBody.RotateAngleY) * 5F; BipedRightArm.RotationPointX = -MathHelper2.Cos(BipedBody.RotateAngleY) * 5F; BipedLeftArm.RotationPointZ = -MathHelper2.Sin(BipedBody.RotateAngleY) * 5F; BipedLeftArm.RotationPointX = MathHelper2.Cos(BipedBody.RotateAngleY) * 5F; BipedRightArm.RotateAngleY += BipedBody.RotateAngleY; BipedLeftArm.RotateAngleY += BipedBody.RotateAngleY; BipedLeftArm.RotateAngleX += BipedBody.RotateAngleY; f = 1.0F - OnGround; f *= f; f *= f; f = 1.0F - f; float f2 = MathHelper2.Sin(f * (float)Math.PI); float f4 = MathHelper2.Sin(OnGround * (float)Math.PI) * -(BipedHead.RotateAngleX - 0.7F) * 0.75F; BipedRightArm.RotateAngleX -= f2 * 1.2F + f4; BipedRightArm.RotateAngleY += BipedBody.RotateAngleY * 2.0F; BipedRightArm.RotateAngleZ = MathHelper2.Sin(OnGround * (float)Math.PI) * -0.4F; } if (IsSneak) { BipedBody.RotateAngleX = 0.5F; BipedRightArm.RotateAngleX += 0.4F; BipedLeftArm.RotateAngleX += 0.4F; BipedRightLeg.RotationPointZ = 4F; BipedLeftLeg.RotationPointZ = 4F; BipedRightLeg.RotationPointY = 9F; BipedLeftLeg.RotationPointY = 9F; BipedHead.RotationPointY = 1.0F; } else { BipedBody.RotateAngleX = 0.0F; BipedRightLeg.RotationPointZ = 0.0F; BipedLeftLeg.RotationPointZ = 0.0F; BipedRightLeg.RotationPointY = 12F; BipedLeftLeg.RotationPointY = 12F; BipedHead.RotationPointY = 0.0F; } BipedRightArm.RotateAngleZ += MathHelper2.Cos(par3 * 0.09F) * 0.05F + 0.05F; BipedLeftArm.RotateAngleZ -= MathHelper2.Cos(par3 * 0.09F) * 0.05F + 0.05F; BipedRightArm.RotateAngleX += MathHelper2.Sin(par3 * 0.067F) * 0.05F; BipedLeftArm.RotateAngleX -= MathHelper2.Sin(par3 * 0.067F) * 0.05F; if (AimedBow) { float f1 = 0.0F; float f3 = 0.0F; BipedRightArm.RotateAngleZ = 0.0F; BipedLeftArm.RotateAngleZ = 0.0F; BipedRightArm.RotateAngleY = -(0.1F - f1 * 0.6F) + BipedHead.RotateAngleY; BipedLeftArm.RotateAngleY = (0.1F - f1 * 0.6F) + BipedHead.RotateAngleY + 0.4F; BipedRightArm.RotateAngleX = -((float)Math.PI / 2F) + BipedHead.RotateAngleX; BipedLeftArm.RotateAngleX = -((float)Math.PI / 2F) + BipedHead.RotateAngleX; BipedRightArm.RotateAngleX -= f1 * 1.2F - f3 * 0.4F; BipedLeftArm.RotateAngleX -= f1 * 1.2F - f3 * 0.4F; BipedRightArm.RotateAngleZ += MathHelper2.Cos(par3 * 0.09F) * 0.05F + 0.05F; BipedLeftArm.RotateAngleZ -= MathHelper2.Cos(par3 * 0.09F) * 0.05F + 0.05F; BipedRightArm.RotateAngleX += MathHelper2.Sin(par3 * 0.067F) * 0.05F; BipedLeftArm.RotateAngleX -= MathHelper2.Sin(par3 * 0.067F) * 0.05F; } }
/// <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); } }
private double[] Func_40379_a(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) { if (par1ArrayOfDouble == null) { par1ArrayOfDouble = new double[par5 * par6 * par7]; } double d = 684.41200000000003D; double d1 = 684.41200000000003D; NoiseData4 = NoiseGen4.GenerateNoiseOctaves(NoiseData4, par2, par4, par5, par7, 1.121D, 1.121D, 0.5D); NoiseData5 = NoiseGen5.GenerateNoiseOctaves(NoiseData5, par2, par4, par5, par7, 200D, 200D, 0.5D); d *= 2D; NoiseData1 = noiseGen3.GenerateNoiseOctaves(NoiseData1, par2, par3, par4, par5, par6, par7, d / 80D, d1 / 160D, d / 80D); NoiseData2 = noiseGen1.GenerateNoiseOctaves(NoiseData2, par2, par3, par4, par5, par6, par7, d, d1, d); NoiseData3 = noiseGen2.GenerateNoiseOctaves(NoiseData3, par2, par3, par4, par5, par6, par7, d, d1, d); int i = 0; int j = 0; for (int k = 0; k < par5; k++) { for (int l = 0; l < par7; l++) { double d2 = (NoiseData4[j] + 256D) / 512D; if (d2 > 1.0D) { d2 = 1.0D; } double d3 = NoiseData5[j] / 8000D; if (d3 < 0.0F) { d3 = -d3 * 0.29999999999999999D; } d3 = d3 * 3D - 2D; float f = (float)((k + par2) - 0) / 1.0F; float f1 = (float)((l + par4) - 0) / 1.0F; float f2 = 100F - MathHelper2.Sqrt_float(f * f + f1 * f1) * 8F; if (f2 > 80F) { f2 = 80F; } if (f2 < -100F) { f2 = -100F; } if (d3 > 1.0D) { d3 = 1.0D; } d3 /= 8D; d3 = 0.0F; if (d2 < 0.0F) { d2 = 0.0F; } d2 += 0.5D; d3 = (d3 * (double)par6) / 16D; j++; double d4 = (double)par6 / 2D; for (int i1 = 0; i1 < par6; i1++) { double d5 = 0.0F; double d6 = (((double)i1 - d4) * 8D) / d2; if (d6 < 0.0F) { d6 *= -1D; } double d7 = NoiseData2[i] / 512D; double d8 = NoiseData3[i] / 512D; double d9 = (NoiseData1[i] / 10D + 1.0D) / 2D; if (d9 < 0.0F) { d5 = d7; } else if (d9 > 1.0D) { d5 = d8; } else { d5 = d7 + (d8 - d7) * d9; } d5 -= 8D; d5 += f2; int j1 = 2; if (i1 > par6 / 2 - j1) { double d10 = (float)(i1 - (par6 / 2 - j1)) / 64F; if (d10 < 0.0F) { d10 = 0.0F; } if (d10 > 1.0D) { d10 = 1.0D; } d5 = d5 * (1.0D - d10) + -3000D * d10; } j1 = 8; if (i1 < j1) { double d11 = (float)(j1 - i1) / ((float)j1 - 1.0F); d5 = d5 * (1.0D - d11) + -30D * d11; } par1ArrayOfDouble[i] = d5; i++; } } } return(par1ArrayOfDouble); }