public EntityArrow(World par1World, EntityLiving par2EntityLiving, float par3) : base(par1World) { XTile = -1; YTile = -1; ZTile = -1; InTile = 0; InData = 0; InGround = false; DoesArrowBelongToPlayer = false; ArrowShake = 0; TicksInAir = 0; Damage = 2D; ArrowCritical = false; ShootingEntity = par2EntityLiving; DoesArrowBelongToPlayer = par2EntityLiving is EntityPlayer; SetSize(0.5F, 0.5F); SetLocationAndAngles(par2EntityLiving.PosX, par2EntityLiving.PosY + par2EntityLiving.GetEyeHeight(), par2EntityLiving.PosZ, par2EntityLiving.RotationYaw, par2EntityLiving.RotationPitch); PosX -= MathHelper2.Cos((RotationYaw / 180F) * (float)Math.PI) * 0.16F; PosY -= 0.10000000149011612F; PosZ -= MathHelper2.Sin((RotationYaw / 180F) * (float)Math.PI) * 0.16F; SetPosition(PosX, PosY, PosZ); YOffset = 0.0F; MotionX = -MathHelper2.Sin((RotationYaw / 180F) * (float)Math.PI) * MathHelper2.Cos((RotationPitch / 180F) * (float)Math.PI); MotionZ = MathHelper2.Cos((RotationYaw / 180F) * (float)Math.PI) * MathHelper2.Cos((RotationPitch / 180F) * (float)Math.PI); MotionY = -MathHelper2.Sin((RotationPitch / 180F) * (float)Math.PI); SetArrowHeading(MotionX, MotionY, MotionZ, par3 * 1.5F, 1.0F); }
/// <summary> /// Updates the current render info and camera location based on entity look angles and 1st/3rd person view mode /// </summary> public static void UpdateRenderInfo(EntityPlayer par0EntityPlayer, bool par1) { //GL.GetFloat(GetPName.ModelviewMatrix, out Modelview); //GL.GetFloat(GetPName.ProjectionMatrix, out Projection); int[] viewints = new int[4]; //GL.GetInteger(GetPName.Viewport, viewints); Viewport = new Rectangle(viewints[0], viewints[1], viewints[2], viewints[3]); float f = (Viewport.X + Viewport.Width) / 2; float f1 = (Viewport.Y + Viewport.Height) / 2; //OpenGlHelper.UnProject(f, f1, 0.0F, Modelview, Projection, Viewport.Size, ObjectCoords); ObjectX = ObjectCoords.X; ObjectY = ObjectCoords.Y; ObjectZ = ObjectCoords.Z; int i = par1 ? 1 : 0; float f2 = par0EntityPlayer.RotationPitch; float f3 = par0EntityPlayer.RotationYaw; RotationX = MathHelper2.Cos((f3 * (float)Math.PI) / 180F) * (float)(1 - i * 2); RotationZ = MathHelper2.Sin((f3 * (float)Math.PI) / 180F) * (float)(1 - i * 2); RotationYZ = -RotationZ *MathHelper2.Sin((f2 * (float)Math.PI) / 180F) * (float)(1 - i * 2); RotationXY = RotationX * MathHelper2.Sin((f2 * (float)Math.PI) / 180F) * (float)(1 - i * 2); RotationXZ = MathHelper2.Cos((f2 * (float)Math.PI) / 180F); }
/// <summary> /// Sets the models various rotation angles. /// </summary> public override void SetRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6) { Field_48220_g.RotateAngleX = par5 / (180F / (float)Math.PI); Field_48220_g.RotateAngleY = par4 / (180F / (float)Math.PI); if (Field_48227_o != 3) { Field_48226_n.RotateAngleX = ((float)Math.PI / 2F); if (Field_48227_o == 2) { Field_48225_a.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F) * 1.0F * par2; Field_48223_b.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F + 0.3F) * 1.0F * par2; Field_48224_c.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F + (float)Math.PI + 0.3F) * 1.0F * par2; Field_48221_d.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F + (float)Math.PI) * 1.0F * par2; Field_48219_f.RotateAngleX = 1.727876F + ((float)Math.PI / 10F) * MathHelper2.Cos(par1) * par2; } else { Field_48225_a.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F) * 1.0F * par2; Field_48223_b.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F + (float)Math.PI) * 1.0F * par2; Field_48224_c.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F + (float)Math.PI) * 1.0F * par2; Field_48221_d.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F) * 1.0F * par2; if (Field_48227_o == 1) { Field_48219_f.RotateAngleX = 1.727876F + ((float)Math.PI / 4F) * MathHelper2.Cos(par1) * par2; } else { Field_48219_f.RotateAngleX = 1.727876F + 0.4712389F * MathHelper2.Cos(par1) * par2; } } } }
public EntityFishHook(World par1World, EntityPlayer par2EntityPlayer) : base(par1World) { XTile = -1; YTile = -1; ZTile = -1; InTile = 0; InGround = false; Shake = 0; TicksInAir = 0; TicksCatchable = 0; Bobber = null; IgnoreFrustumCheck = true; Angler = par2EntityPlayer; Angler.FishEntity = this; SetSize(0.25F, 0.25F); SetLocationAndAngles(par2EntityPlayer.PosX, (par2EntityPlayer.PosY + 1.6200000000000001F) - par2EntityPlayer.YOffset, par2EntityPlayer.PosZ, par2EntityPlayer.RotationYaw, par2EntityPlayer.RotationPitch); PosX -= MathHelper2.Cos((RotationYaw / 180F) * (float)Math.PI) * 0.16F; PosY -= 0.10000000149011612F; PosZ -= MathHelper2.Sin((RotationYaw / 180F) * (float)Math.PI) * 0.16F; SetPosition(PosX, PosY, PosZ); YOffset = 0.0F; float f = 0.4F; MotionX = -MathHelper2.Sin((RotationYaw / 180F) * (float)Math.PI) * MathHelper2.Cos((RotationPitch / 180F) * (float)Math.PI) * f; MotionZ = MathHelper2.Cos((RotationYaw / 180F) * (float)Math.PI) * MathHelper2.Cos((RotationPitch / 180F) * (float)Math.PI) * f; MotionY = -MathHelper2.Sin((RotationPitch / 180F) * (float)Math.PI) * f; CalculateVelocity(MotionX, MotionY, MotionZ, 1.5F, 1.0F); }
/// <summary> /// Sets the models various rotation angles. /// </summary> public override void SetRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6) { float f = par3 * (float)Math.PI * -0.1F; for (int i = 0; i < 4; i++) { Field_40323_a[i].RotationPointY = -2F + MathHelper2.Cos(((float)(i * 2) + par3) * 0.25F); Field_40323_a[i].RotationPointX = MathHelper2.Cos(f) * 9F; Field_40323_a[i].RotationPointZ = MathHelper2.Sin(f) * 9F; f += ((float)Math.PI / 2F); } f = ((float)Math.PI / 4F) + par3 * (float)Math.PI * 0.03F; for (int j = 4; j < 8; j++) { Field_40323_a[j].RotationPointY = 2.0F + MathHelper2.Cos(((float)(j * 2) + par3) * 0.25F); Field_40323_a[j].RotationPointX = MathHelper2.Cos(f) * 7F; Field_40323_a[j].RotationPointZ = MathHelper2.Sin(f) * 7F; f += ((float)Math.PI / 2F); } f = 0.4712389F + par3 * (float)Math.PI * -0.05F; for (int k = 8; k < 12; k++) { Field_40323_a[k].RotationPointY = 11F + MathHelper2.Cos(((float)k * 1.5F + par3) * 0.5F); Field_40323_a[k].RotationPointX = MathHelper2.Cos(f) * 5F; Field_40323_a[k].RotationPointZ = MathHelper2.Sin(f) * 5F; f += ((float)Math.PI / 2F); } Field_40322_b.RotateAngleY = par4 / (180F / (float)Math.PI); Field_40322_b.RotateAngleX = par5 / (180F / (float)Math.PI); }
/// <summary> /// Sets the listener of sounds /// </summary> public void SetListener(EntityLiving par1EntityLiving, float par2) { if (!Loaded || Options.SoundVolume == 0.0F) { return; } if (par1EntityLiving == null) { return; } else { float f = par1EntityLiving.PrevRotationYaw + (par1EntityLiving.RotationYaw - par1EntityLiving.PrevRotationYaw) * par2; double d = par1EntityLiving.PrevPosX + (par1EntityLiving.PosX - par1EntityLiving.PrevPosX) * (double)par2; double d1 = par1EntityLiving.PrevPosY + (par1EntityLiving.PosY - par1EntityLiving.PrevPosY) * (double)par2; double d2 = par1EntityLiving.PrevPosZ + (par1EntityLiving.PosZ - par1EntityLiving.PrevPosZ) * (double)par2; float f1 = MathHelper2.Cos(-f * 0.01745329F - (float)Math.PI); float f2 = MathHelper2.Sin(-f * 0.01745329F - (float)Math.PI); float f3 = -f2; float f4 = 0.0F; float f5 = -f1; float f6 = 0.0F; float f7 = 1.0F; float f8 = 0.0F; /* * SndSystem.setListenerPosition((float)d, (float)d1, (float)d2); * SndSystem.setListenerOrientation(f3, f4, f5, f6, f7, f8);*/ return; } }
public override bool Generate(World par1World, Random par2Random, int par3, int par4, int par5) { float f = par2Random.NextFloat() * (float)Math.PI; double d = (float)(par3 + 8) + (MathHelper2.Sin(f) * (float)NumberOfBlocks) / 8F; double d1 = (float)(par3 + 8) - (MathHelper2.Sin(f) * (float)NumberOfBlocks) / 8F; double d2 = (float)(par5 + 8) + (MathHelper2.Cos(f) * (float)NumberOfBlocks) / 8F; double d3 = (float)(par5 + 8) - (MathHelper2.Cos(f) * (float)NumberOfBlocks) / 8F; double d4 = (par4 + par2Random.Next(3)) - 2; double d5 = (par4 + par2Random.Next(3)) - 2; for (int i = 0; i <= NumberOfBlocks; i++) { double d6 = d + ((d1 - d) * (double)i) / (double)NumberOfBlocks; double d7 = d4 + ((d5 - d4) * (double)i) / (double)NumberOfBlocks; double d8 = d2 + ((d3 - d2) * (double)i) / (double)NumberOfBlocks; double d9 = (par2Random.NextDouble() * (double)NumberOfBlocks) / 16D; double d10 = (double)(MathHelper2.Sin(((float)i * (float)Math.PI) / (float)NumberOfBlocks) + 1.0F) * d9 + 1.0D; double d11 = (double)(MathHelper2.Sin(((float)i * (float)Math.PI) / (float)NumberOfBlocks) + 1.0F) * d9 + 1.0D; int j = MathHelper2.Floor_double(d6 - d10 / 2D); int k = MathHelper2.Floor_double(d7 - d11 / 2D); int l = MathHelper2.Floor_double(d8 - d10 / 2D); int i1 = MathHelper2.Floor_double(d6 + d10 / 2D); int j1 = MathHelper2.Floor_double(d7 + d11 / 2D); int k1 = MathHelper2.Floor_double(d8 + d10 / 2D); for (int l1 = j; l1 <= i1; l1++) { double d12 = (((double)l1 + 0.5D) - d6) / (d10 / 2D); if (d12 * d12 >= 1.0D) { continue; } for (int i2 = k; i2 <= j1; i2++) { double d13 = (((double)i2 + 0.5D) - d7) / (d11 / 2D); if (d12 * d12 + d13 * d13 >= 1.0D) { continue; } for (int j2 = l; j2 <= k1; j2++) { double d14 = (((double)j2 + 0.5D) - d8) / (d10 / 2D); if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && par1World.GetBlockId(l1, i2, j2) == Block.Stone.BlockID) { par1World.SetBlock(l1, i2, j2, MinableBlockId); } } } } } return(true); }
/// <summary> /// Used for easily adding entity-dependent animations. The second and third float params here are the same second /// and third as in the setRotationAngles method. /// </summary> public override void SetLivingAnimations(EntityLiving par1EntityLiving, float par2, float par3, float par4) { EntityWolf entitywolf = (EntityWolf)par1EntityLiving; if (entitywolf.IsAngry()) { WolfTail.RotateAngleY = 0.0F; } else { WolfTail.RotateAngleY = MathHelper2.Cos(par2 * 0.6662F) * 1.4F * par3; } if (entitywolf.IsSitting()) { WolfMane.SetRotationPoint(-1F, 16F, -3F); WolfMane.RotateAngleX = ((float)Math.PI * 2F / 5F); WolfMane.RotateAngleY = 0.0F; WolfBody.SetRotationPoint(0.0F, 18F, 0.0F); WolfBody.RotateAngleX = ((float)Math.PI / 4F); WolfTail.SetRotationPoint(-1F, 21F, 6F); WolfLeg1.SetRotationPoint(-2.5F, 22F, 2.0F); WolfLeg1.RotateAngleX = ((float)Math.PI * 3F / 2F); WolfLeg2.SetRotationPoint(0.5F, 22F, 2.0F); WolfLeg2.RotateAngleX = ((float)Math.PI * 3F / 2F); WolfLeg3.RotateAngleX = 5.811947F; WolfLeg3.SetRotationPoint(-2.49F, 17F, -4F); WolfLeg4.RotateAngleX = 5.811947F; WolfLeg4.SetRotationPoint(0.51F, 17F, -4F); } else { WolfBody.SetRotationPoint(0.0F, 14F, 2.0F); WolfBody.RotateAngleX = ((float)Math.PI / 2F); WolfMane.SetRotationPoint(-1F, 14F, -3F); WolfMane.RotateAngleX = WolfBody.RotateAngleX; WolfTail.SetRotationPoint(-1F, 12F, 8F); WolfLeg1.SetRotationPoint(-2.5F, 16F, 7F); WolfLeg2.SetRotationPoint(0.5F, 16F, 7F); WolfLeg3.SetRotationPoint(-2.5F, 16F, -4F); WolfLeg4.SetRotationPoint(0.5F, 16F, -4F); WolfLeg1.RotateAngleX = MathHelper2.Cos(par2 * 0.6662F) * 1.4F * par3; WolfLeg2.RotateAngleX = MathHelper2.Cos(par2 * 0.6662F + (float)Math.PI) * 1.4F * par3; WolfLeg3.RotateAngleX = MathHelper2.Cos(par2 * 0.6662F + (float)Math.PI) * 1.4F * par3; WolfLeg4.RotateAngleX = MathHelper2.Cos(par2 * 0.6662F) * 1.4F * par3; } WolfHeadMain.RotateAngleZ = entitywolf.GetInterestedAngle(par4) + entitywolf.GetShakeAngle(par4, 0.0F); WolfMane.RotateAngleZ = entitywolf.GetShakeAngle(par4, -0.08F); WolfBody.RotateAngleZ = entitywolf.GetShakeAngle(par4, -0.16F); WolfTail.RotateAngleZ = entitywolf.GetShakeAngle(par4, -0.2F); if (entitywolf.GetWolfShaking()) { float f = entitywolf.GetBrightness(par4) * entitywolf.GetShadingWhileShaking(par4); //GL.Color3(f, f, f); } }
/// <summary> /// Sets the models various rotation angles. /// </summary> public override void SetRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6) { Head.RotateAngleY = par4 / (180F / (float)Math.PI); Head.RotateAngleX = par5 / (180F / (float)Math.PI); Leg1.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F) * 1.4F * par2; Leg2.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2; Leg3.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2; Leg4.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F) * 1.4F * par2; }
/// <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> /// Rotates the vector around the y axis by the specified angle. /// </summary> public virtual void RotateAroundY(float par1) { float f = MathHelper2.Cos(par1); float f1 = MathHelper2.Sin(par1); double d = XCoord * (double)f + ZCoord * (double)f1; double d1 = YCoord; double d2 = ZCoord * (double)f - XCoord * (double)f1; XCoord = d; YCoord = d1; ZCoord = d2; }
/// <summary> /// Sets the models various rotation angles. /// </summary> public override void SetRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6) { Field_40340_a.RotateAngleY = par4 / (180F / (float)Math.PI); Field_40340_a.RotateAngleX = par5 / (180F / (float)Math.PI); Field_40339_c.RotationPointY = 3F; Field_40339_c.RotationPointZ = -1F; Field_40339_c.RotateAngleX = -0.75F; Field_40336_d.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F) * 1.4F * par2 * 0.5F; Field_40337_e.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2 * 0.5F; Field_40336_d.RotateAngleY = 0.0F; Field_40337_e.RotateAngleY = 0.0F; }
/// <summary> /// Sets the models various rotation angles. /// </summary> public override void SetRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6) { SpiderHead.RotateAngleY = par4 / (180F / (float)Math.PI); SpiderHead.RotateAngleX = par5 / (180F / (float)Math.PI); float f = ((float)Math.PI / 4F); SpiderLeg1.RotateAngleZ = -f; SpiderLeg2.RotateAngleZ = f; SpiderLeg3.RotateAngleZ = -f * 0.74F; SpiderLeg4.RotateAngleZ = f * 0.74F; SpiderLeg5.RotateAngleZ = -f * 0.74F; SpiderLeg6.RotateAngleZ = f * 0.74F; SpiderLeg7.RotateAngleZ = -f; SpiderLeg8.RotateAngleZ = f; float f1 = -0F; float f2 = 0.3926991F; SpiderLeg1.RotateAngleY = f2 * 2.0F + f1; SpiderLeg2.RotateAngleY = -f2 * 2.0F - f1; SpiderLeg3.RotateAngleY = f2 * 1.0F + f1; SpiderLeg4.RotateAngleY = -f2 * 1.0F - f1; SpiderLeg5.RotateAngleY = -f2 * 1.0F + f1; SpiderLeg6.RotateAngleY = f2 * 1.0F - f1; SpiderLeg7.RotateAngleY = -f2 * 2.0F + f1; SpiderLeg8.RotateAngleY = f2 * 2.0F - f1; float f3 = -(MathHelper2.Cos(par1 * 0.6662F * 2.0F + 0.0F) * 0.4F) * par2; float f4 = -(MathHelper2.Cos(par1 * 0.6662F * 2.0F + (float)Math.PI) * 0.4F) * par2; float f5 = -(MathHelper2.Cos(par1 * 0.6662F * 2.0F + ((float)Math.PI / 2F)) * 0.4F) * par2; float f6 = -(MathHelper2.Cos(par1 * 0.6662F * 2.0F + ((float)Math.PI * 3F / 2F)) * 0.4F) * par2; float f7 = Math.Abs(MathHelper2.Sin(par1 * 0.6662F + 0.0F) * 0.4F) * par2; float f8 = Math.Abs(MathHelper2.Sin(par1 * 0.6662F + (float)Math.PI) * 0.4F) * par2; float f9 = Math.Abs(MathHelper2.Sin(par1 * 0.6662F + ((float)Math.PI / 2F)) * 0.4F) * par2; float f10 = Math.Abs(MathHelper2.Sin(par1 * 0.6662F + ((float)Math.PI * 3F / 2F)) * 0.4F) * par2; SpiderLeg1.RotateAngleY += f3; SpiderLeg2.RotateAngleY += -f3; SpiderLeg3.RotateAngleY += f4; SpiderLeg4.RotateAngleY += -f4; SpiderLeg5.RotateAngleY += f5; SpiderLeg6.RotateAngleY += -f5; SpiderLeg7.RotateAngleY += f6; SpiderLeg8.RotateAngleY += -f6; SpiderLeg1.RotateAngleZ += f7; SpiderLeg2.RotateAngleZ += -f7; SpiderLeg3.RotateAngleZ += f8; SpiderLeg4.RotateAngleZ += -f8; SpiderLeg5.RotateAngleZ += f9; SpiderLeg6.RotateAngleZ += -f9; SpiderLeg7.RotateAngleZ += f10; SpiderLeg8.RotateAngleZ += -f10; }
/// <summary> /// Sets the models various rotation angles. /// </summary> public override void SetRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6) { Head.RotateAngleX = -(par5 / (180F / (float)Math.PI)); Head.RotateAngleY = par4 / (180F / (float)Math.PI); Bill.RotateAngleX = Head.RotateAngleX; Bill.RotateAngleY = Head.RotateAngleY; Chin.RotateAngleX = Head.RotateAngleX; Chin.RotateAngleY = Head.RotateAngleY; Body.RotateAngleX = ((float)Math.PI / 2F); RightLeg.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F) * 1.4F * par2; LeftLeg.RotateAngleX = MathHelper2.Cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2; RightWing.RotateAngleZ = par3; LeftWing.RotateAngleZ = -par3; }
/// <summary> /// Sets the models various rotation angles. /// </summary> public override void SetRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6) { for (int i = 0; i < SilverfishBodyParts.Length; i++) { SilverfishBodyParts[i].RotateAngleY = MathHelper2.Cos(par3 * 0.9F + (float)i * 0.15F * (float)Math.PI) * (float)Math.PI * 0.05F * (float)(1 + Math.Abs(i - 2)); SilverfishBodyParts[i].RotationPointX = MathHelper2.Sin(par3 * 0.9F + (float)i * 0.15F * (float)Math.PI) * (float)Math.PI * 0.2F * (float)Math.Abs(i - 2); } SilverfishWings[0].RotateAngleY = SilverfishBodyParts[2].RotateAngleY; SilverfishWings[1].RotateAngleY = SilverfishBodyParts[4].RotateAngleY; SilverfishWings[1].RotationPointX = SilverfishBodyParts[4].RotationPointX; SilverfishWings[2].RotateAngleY = SilverfishBodyParts[1].RotateAngleY; SilverfishWings[2].RotationPointX = SilverfishBodyParts[1].RotationPointX; }
/// <summary> /// Sets the models various rotation angles. /// </summary> public override void SetRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6) { base.SetRotationAngles(par1, par2, par3, par4, par5, par6); Field_40305_c.RotateAngleY = par4 / (180F / (float)Math.PI); Field_40305_c.RotateAngleX = par5 / (180F / (float)Math.PI); Field_40306_a.RotateAngleY = (par4 / (180F / (float)Math.PI)) * 0.25F; float f = MathHelper2.Sin(Field_40306_a.RotateAngleY); float f1 = MathHelper2.Cos(Field_40306_a.RotateAngleY); Field_40302_d.RotateAngleZ = 1.0F; Field_40303_e.RotateAngleZ = -1F; Field_40302_d.RotateAngleY = 0.0F + Field_40306_a.RotateAngleY; Field_40303_e.RotateAngleY = (float)Math.PI + Field_40306_a.RotateAngleY; Field_40302_d.RotationPointX = f1 * 5F; Field_40302_d.RotationPointZ = -f * 5F; Field_40303_e.RotationPointX = -f1 * 5F; Field_40303_e.RotationPointZ = f * 5F; }
public override void UpdateEntityActionState() { EntityAge++; if (EntityAge > 100) { RandomMotionVecX = RandomMotionVecY = RandomMotionVecZ = 0.0F; } else if (Rand.Next(50) == 0 || !InWater || RandomMotionVecX == 0.0F && RandomMotionVecY == 0.0F && RandomMotionVecZ == 0.0F) { float f = Rand.NextFloat() * (float)Math.PI * 2.0F; RandomMotionVecX = MathHelper2.Cos(f) * 0.2F; RandomMotionVecY = -0.1F + Rand.NextFloat() * 0.2F; RandomMotionVecZ = MathHelper2.Sin(f) * 0.2F; } DespawnEntity(); }
/// <summary> /// Sets the models various rotation angles. /// </summary> public override void SetRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6) { base.SetRotationAngles(par1, par2, par3, par4, par5, par6); float f = MathHelper2.Sin(OnGround * (float)Math.PI); float f1 = MathHelper2.Sin((1.0F - (1.0F - OnGround) * (1.0F - OnGround)) * (float)Math.PI); BipedRightArm.RotateAngleZ = 0.0F; BipedLeftArm.RotateAngleZ = 0.0F; BipedRightArm.RotateAngleY = -(0.1F - f * 0.6F); BipedLeftArm.RotateAngleY = 0.1F - f * 0.6F; BipedRightArm.RotateAngleX = -((float)Math.PI / 2F); BipedLeftArm.RotateAngleX = -((float)Math.PI / 2F); BipedRightArm.RotateAngleX -= f * 1.2F - f1 * 0.4F; BipedLeftArm.RotateAngleX -= f * 1.2F - f1 * 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; }
protected virtual MovingObjectPosition GetMovingObjectPositionFromPlayer(World par1World, EntityPlayer par2EntityPlayer, bool par3) { float f = 1.0F; float f1 = par2EntityPlayer.PrevRotationPitch + (par2EntityPlayer.RotationPitch - par2EntityPlayer.PrevRotationPitch) * f; float f2 = par2EntityPlayer.PrevRotationYaw + (par2EntityPlayer.RotationYaw - par2EntityPlayer.PrevRotationYaw) * f; double d = par2EntityPlayer.PrevPosX + (par2EntityPlayer.PosX - par2EntityPlayer.PrevPosX) * (double)f; double d1 = (par2EntityPlayer.PrevPosY + (par2EntityPlayer.PosY - par2EntityPlayer.PrevPosY) * (double)f + 1.6200000000000001D) - (double)par2EntityPlayer.YOffset; double d2 = par2EntityPlayer.PrevPosZ + (par2EntityPlayer.PosZ - par2EntityPlayer.PrevPosZ) * (double)f; Vec3D vec3d = Vec3D.CreateVector(d, d1, d2); float f3 = MathHelper2.Cos(-f2 * 0.01745329F - (float)Math.PI); float f4 = MathHelper2.Sin(-f2 * 0.01745329F - (float)Math.PI); float f5 = -MathHelper2.Cos(-f1 * 0.01745329F); float f6 = MathHelper2.Sin(-f1 * 0.01745329F); float f7 = f4 * f5; float f8 = f6; float f9 = f3 * f5; double d3 = 5D; Vec3D vec3d1 = vec3d.AddVector((double)f7 * d3, (double)f8 * d3, (double)f9 * d3); MovingObjectPosition movingobjectposition = par1World.RayTraceBlocks_do_do(vec3d, vec3d1, par3, !par3); return(movingobjectposition); }
/// <summary> /// Returns array with sunrise/sunset colors /// </summary> public virtual float[] CalcSunriseSunsetColors(float par1, float par2) { float f = 0.4F; float f1 = MathHelper2.Cos(par1 * (float)Math.PI * 2.0F) - 0.0F; float f2 = -0F; if (f1 >= f2 - f && f1 <= f2 + f) { float f3 = ((f1 - f2) / f) * 0.5F + 0.5F; float f4 = 1.0F - (1.0F - MathHelper2.Sin(f3 * (float)Math.PI)) * 0.99F; f4 *= f4; ColorsSunriseSunset[0] = f3 * 0.3F + 0.7F; ColorsSunriseSunset[1] = f3 * f3 * 0.7F + 0.2F; ColorsSunriseSunset[2] = f3 * f3 * 0.0F + 0.2F; ColorsSunriseSunset[3] = f4; return(ColorsSunriseSunset); } else { return(null); } }
public override bool AttackEntityFromPart(EntityDragonPart par1EntityDragonPart, DamageSource par2DamageSource, int par3) { if (par1EntityDragonPart != DragonPartHead) { par3 = par3 / 4 + 1; } float f = (RotationYaw * (float)Math.PI) / 180F; float f1 = MathHelper2.Sin(f); float f2 = MathHelper2.Cos(f); TargetX = PosX + (f1 * 5F) + ((Rand.NextFloat() - 0.5F) * 2.0F); TargetY = PosY + (Rand.NextFloat() * 3F) + 1.0F; TargetZ = (PosZ - (f2 * 5F)) + ((Rand.NextFloat() - 0.5F) * 2.0F); Target = null; if ((par2DamageSource.GetEntity() is EntityPlayer) || par2DamageSource == DamageSource.Explosion) { SuperAttackFrom(par2DamageSource, par3); } return(true); }
/// <summary> /// Return Vec3D with biome specific fog color /// </summary> public virtual Vec3D GetFogColor(float par1, float par2) { float f = MathHelper2.Cos(par1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; if (f < 0.0F) { f = 0.0F; } if (f > 1.0F) { f = 1.0F; } float f1 = 0.7529412F; float f2 = 0.8470588F; float f3 = 1.0F; f1 *= f * 0.94F + 0.06F; f2 *= f * 0.94F + 0.06F; f3 *= f * 0.91F + 0.09F; return(Vec3D.CreateVector(f1, f2, f3)); }
/// <summary> /// Return Vec3D with biome specific fog color /// </summary> public override Vec3D GetFogColor(float par1, float par2) { int i = 0x8080a0; float f = MathHelper2.Cos(par1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; if (f < 0.0F) { f = 0.0F; } if (f > 1.0F) { f = 1.0F; } float f1 = (float)(i >> 16 & 0xff) / 255F; float f2 = (float)(i >> 8 & 0xff) / 255F; float f3 = (float)(i & 0xff) / 255F; f1 *= f * 0.0F + 0.15F; f2 *= f * 0.0F + 0.15F; f3 *= f * 0.0F + 0.15F; return(Vec3D.CreateVector(f1, f2, f3)); }
public EntityThrowable(World par1World, EntityLiving par2EntityLiving) : base(par1World) { XTile = -1; YTile = -1; ZTile = -1; InTile = 0; InGround = false; ThrowableShake = 0; TicksInAir = 0; Thrower = par2EntityLiving; SetSize(0.25F, 0.25F); SetLocationAndAngles(par2EntityLiving.PosX, par2EntityLiving.PosY + par2EntityLiving.GetEyeHeight(), par2EntityLiving.PosZ, par2EntityLiving.RotationYaw, par2EntityLiving.RotationPitch); PosX -= MathHelper2.Cos((RotationYaw / 180F) * (float)Math.PI) * 0.16F; PosY -= 0.10000000149011612F; PosZ -= MathHelper2.Sin((RotationYaw / 180F) * (float)Math.PI) * 0.16F; SetPosition(PosX, PosY, PosZ); YOffset = 0.0F; float f = 0.4F; MotionX = -MathHelper2.Sin((RotationYaw / 180F) * (float)Math.PI) * MathHelper2.Cos((RotationPitch / 180F) * (float)Math.PI) * f; MotionZ = MathHelper2.Cos((RotationYaw / 180F) * (float)Math.PI) * MathHelper2.Cos((RotationPitch / 180F) * (float)Math.PI) * f; MotionY = -MathHelper2.Sin(((RotationPitch + Func_40074_d()) / 180F) * (float)Math.PI) * f; SetThrowableHeading(MotionX, MotionY, MotionZ, Func_40077_c(), 1.0F); }
public virtual void Func_1187_b(Entity par1Entity, float par2) { float f = MathHelper2.Cos(par1Entity.RotationYaw * 0.01745329F); float f1 = MathHelper2.Sin(par1Entity.RotationYaw * 0.01745329F); float f2 = -f1 *MathHelper2.Sin(par1Entity.RotationPitch * 0.01745329F); float f3 = f * MathHelper2.Sin(par1Entity.RotationPitch * 0.01745329F); float f4 = MathHelper2.Cos(par1Entity.RotationPitch * 0.01745329F); sbyte byte0 = 3; if (FxLayers[byte0].Count == 0) { return; } Tessellator tessellator = Tessellator.Instance; for (int i = 0; i < FxLayers[byte0].Count; i++) { EntityFX entityfx = FxLayers[byte0][i]; tessellator.SetBrightness(entityfx.GetBrightnessForRender(par2)); entityfx.RenderParticle(tessellator, par2, f, f4, f1, f2, f3); } }
/// <summary> /// Called to update the entity's position/logic. /// </summary> public override void OnUpdate() { if (!WorldObj.IsRemote && WorldObj.DifficultySetting == 0 && GetSlimeSize() > 0) { IsDead = true; } Field_768_a = Field_768_a + (Field_40139_a - Field_768_a) * 0.5F; Field_767_b = Field_768_a; bool flag = OnGround; base.OnUpdate(); if (OnGround && !flag) { int i = GetSlimeSize(); for (int j = 0; j < i * 8; j++) { float f = Rand.NextFloat() * (float)Math.PI * 2.0F; float f1 = Rand.NextFloat() * 0.5F + 0.5F; float f2 = MathHelper2.Sin(f) * (float)i * 0.5F * f1; float f3 = MathHelper2.Cos(f) * (float)i * 0.5F * f1; WorldObj.SpawnParticle(GetSlimeParticle(), PosX + (double)f2, BoundingBox.MinY, PosZ + (double)f3, 0.0F, 0.0F, 0.0F); } if (Func_40134_ak()) { WorldObj.PlaySoundAtEntity(this, Func_40138_aj(), GetSoundVolume(), ((Rand.NextFloat() - Rand.NextFloat()) * 0.2F + 1.0F) / 0.8F); } Field_40139_a = -0.5F; } Func_40136_ag(); }
/// <summary> /// Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons /// use this to react to sunlight and start to burn. /// </summary> public override void OnLivingUpdate() { Field_40173_aw = Field_40172_ax; if (!WorldObj.IsRemote) { DataWatcher.UpdateObject(16, Convert.ToInt32(Health)); } if (Health <= 0) { float f = (Rand.NextFloat() - 0.5F) * 8F; float f2 = (Rand.NextFloat() - 0.5F) * 4F; float f4 = (Rand.NextFloat() - 0.5F) * 8F; WorldObj.SpawnParticle("largeexplode", PosX + (double)f, PosY + 2D + (double)f2, PosZ + (double)f4, 0.0F, 0.0F, 0.0F); return; } UpdateDragonEnderCrystal(); float f1 = 0.2F / (MathHelper2.Sqrt_double(MotionX * MotionX + MotionZ * MotionZ) * 10F + 1.0F); f1 *= (float)Math.Pow(2D, MotionY); if (Field_40161_az) { Field_40172_ax += f1 * 0.5F; } else { Field_40172_ax += f1; } for (; RotationYaw >= 180F; RotationYaw -= 360F) { } for (; RotationYaw < -180F; RotationYaw += 360F) { } if (Field_40164_e < 0) { for (int i = 0; i < Field_40162_d.Length; i++) { Field_40162_d[i][0] = RotationYaw; Field_40162_d[i][1] = PosY; } } if (++Field_40164_e == Field_40162_d.Length) { Field_40164_e = 0; } Field_40162_d[Field_40164_e][0] = RotationYaw; Field_40162_d[Field_40164_e][1] = PosY; if (WorldObj.IsRemote) { if (NewPosRotationIncrements > 0) { float d = PosX + (NewPosX - PosX) / NewPosRotationIncrements; float d2 = PosY + (NewPosY - PosY) / NewPosRotationIncrements; float d4 = PosZ + (NewPosZ - PosZ) / NewPosRotationIncrements; double d6; for (d6 = NewRotationYaw - (double)RotationYaw; d6 < -180D; d6 += 360D) { } for (; d6 >= 180D; d6 -= 360D) { } RotationYaw += (float)d6 / NewPosRotationIncrements; RotationPitch += (float)(NewRotationPitch - RotationPitch) / NewPosRotationIncrements; NewPosRotationIncrements--; SetPosition(d, d2, d4); SetRotation(RotationYaw, RotationPitch); } } else { double d1 = TargetX - PosX; float d3 = TargetY - PosY; double d5 = TargetZ - PosZ; double d7 = d1 * d1 + d3 * d3 + d5 * d5; if (Target != null) { TargetX = Target.PosX; TargetZ = Target.PosZ; float d8 = TargetX - PosX; float d10 = TargetZ - PosZ; float d12 = (float)Math.Sqrt(d8 * d8 + d10 * d10); float d13 = (0.40000000596046448F + d12 / 80F) - 1.0F; if (d13 > 10F) { d13 = 10F; } TargetY = Target.BoundingBox.MinY + d13; } else { TargetX += Rand.NextGaussian() * 2F; TargetZ += Rand.NextGaussian() * 2F; } if (Field_40163_ay || d7 < 100D || d7 > 22500D || IsCollidedHorizontally || IsCollidedVertically) { Func_41006_aA(); } d3 /= MathHelper2.Sqrt_double(d1 * d1 + d5 * d5); float f10 = 0.6F; if (d3 < (double)(-f10)) { d3 = -f10; } if (d3 > (double)f10) { d3 = f10; } MotionY += d3 * 0.10000000149011612F; for (; RotationYaw < -180F; RotationYaw += 360F) { } for (; RotationYaw >= 180F; RotationYaw -= 360F) { } double d9 = 180D - (Math.Atan2(d1, d5) * 180D) / Math.PI; double d11; for (d11 = d9 - (double)RotationYaw; d11 < -180D; d11 += 360D) { } for (; d11 >= 180D; d11 -= 360D) { } if (d11 > 50D) { d11 = 50D; } if (d11 < -50D) { d11 = -50D; } Vec3D vec3d = Vec3D.CreateVector(TargetX - PosX, TargetY - PosY, TargetZ - PosZ).Normalize(); Vec3D vec3d1 = Vec3D.CreateVector(MathHelper2.Sin((RotationYaw * (float)Math.PI) / 180F), MotionY, -MathHelper2.Cos((RotationYaw * (float)Math.PI) / 180F)).Normalize(); float f18 = (float)(vec3d1.DotProduct(vec3d) + 0.5D) / 1.5F; if (f18 < 0.0F) { f18 = 0.0F; } RandomYawVelocity *= 0.8F; float f19 = MathHelper2.Sqrt_double(MotionX * MotionX + MotionZ * MotionZ) * 1.0F + 1.0F; double d14 = Math.Sqrt(MotionX * MotionX + MotionZ * MotionZ) * 1.0D + 1.0D; if (d14 > 40D) { d14 = 40D; } RandomYawVelocity += (float)(d11 * (0.69999998807907104D / d14 / f19)); RotationYaw += RandomYawVelocity * 0.1F; float f20 = (float)(2D / (d14 + 1.0D)); float f21 = 0.06F; MoveFlying(0.0F, -1F, f21 * (f18 * f20 + (1.0F - f20))); if (Field_40161_az) { MoveEntity(MotionX * 0.80000001192092896F, MotionY * 0.80000001192092896F, MotionZ * 0.80000001192092896F); } else { MoveEntity(MotionX, MotionY, MotionZ); } Vec3D vec3d2 = Vec3D.CreateVector(MotionX, MotionY, MotionZ).Normalize(); float f22 = (float)(vec3d2.DotProduct(vec3d1) + 1.0D) / 2.0F; f22 = 0.8F + 0.15F * f22; MotionX *= f22; MotionZ *= f22; MotionY *= 0.9100000262260437F; } RenderYawOffset = RotationYaw; DragonPartHead.Width = DragonPartHead.Height = 3F; DragonPartTail1.Width = DragonPartTail1.Height = 2.0F; DragonPartTail2.Width = DragonPartTail2.Height = 2.0F; DragonPartTail3.Width = DragonPartTail3.Height = 2.0F; DragonPartBody.Height = 3F; DragonPartBody.Width = 5F; DragonPartWing1.Height = 2.0F; DragonPartWing1.Width = 4F; DragonPartWing2.Height = 3F; DragonPartWing2.Width = 4F; float f3 = (((float)(Func_40160_a(5, 1.0F)[1] - Func_40160_a(10, 1.0F)[1]) * 10F) / 180F) * (float)Math.PI; float f5 = MathHelper2.Cos(f3); float f6 = -MathHelper2.Sin(f3); float f7 = (RotationYaw * (float)Math.PI) / 180F; float f8 = MathHelper2.Sin(f7); float f9 = MathHelper2.Cos(f7); DragonPartBody.OnUpdate(); DragonPartBody.SetLocationAndAngles(PosX + (f8 * 0.5F), PosY, PosZ - (f9 * 0.5F), 0.0F, 0.0F); DragonPartWing1.OnUpdate(); DragonPartWing1.SetLocationAndAngles(PosX + (f9 * 4.5F), PosY + 2F, PosZ + (f8 * 4.5F), 0.0F, 0.0F); DragonPartWing2.OnUpdate(); DragonPartWing2.SetLocationAndAngles(PosX - (f9 * 4.5F), PosY + 2F, PosZ - (f8 * 4.5F), 0.0F, 0.0F); if (!WorldObj.IsRemote) { Func_41007_az(); } if (!WorldObj.IsRemote && MaxHurtTime == 0) { CollideWithEntities(WorldObj.GetEntitiesWithinAABBExcludingEntity(this, DragonPartWing1.BoundingBox.Expand(4, 2, 4).Offset(0.0F, -2F, 0.0F))); CollideWithEntities(WorldObj.GetEntitiesWithinAABBExcludingEntity(this, DragonPartWing2.BoundingBox.Expand(4, 2, 4).Offset(0.0F, -2F, 0.0F))); AttackEntitiesInList(WorldObj.GetEntitiesWithinAABBExcludingEntity(this, DragonPartHead.BoundingBox.Expand(1.0F, 1.0F, 1.0F))); } float[] ad = Func_40160_a(5, 1.0F); float[] ad1 = Func_40160_a(0, 1.0F); float f11 = MathHelper2.Sin((RotationYaw * (float)Math.PI) / 180F - RandomYawVelocity * 0.01F); float f12 = MathHelper2.Cos((RotationYaw * (float)Math.PI) / 180F - RandomYawVelocity * 0.01F); DragonPartHead.OnUpdate(); DragonPartHead.SetLocationAndAngles(PosX + (f11 * 5.5F * f5), PosY + (ad1[1] - ad[1]) * 1.0F + (f6 * 5.5F), PosZ - (f12 * 5.5F * f5), 0.0F, 0.0F); for (int j = 0; j < 3; j++) { EntityDragonPart entitydragonpart = null; if (j == 0) { entitydragonpart = DragonPartTail1; } if (j == 1) { entitydragonpart = DragonPartTail2; } if (j == 2) { entitydragonpart = DragonPartTail3; } float[] ad2 = Func_40160_a(12 + j * 2, 1.0F); float f13 = (RotationYaw * (float)Math.PI) / 180F + ((SimplifyAngle(ad2[0] - ad[0]) * (float)Math.PI) / 180F) * 1.0F; float f14 = MathHelper2.Sin(f13); float f15 = MathHelper2.Cos(f13); float f16 = 1.5F; float f17 = (float)(j + 1) * 2.0F; entitydragonpart.OnUpdate(); entitydragonpart.SetLocationAndAngles(PosX - ((f8 * f16 + f14 * f17) * f5), ((PosY + (ad2[1] - ad[1]) * 1.0F) - ((f17 + f16) * f6)) + 1.5F, PosZ + ((f9 * f16 + f15 * f17) * f5), 0.0F, 0.0F); } if (!WorldObj.IsRemote) { Field_40161_az = DestroyBlocksInAABB(DragonPartHead.BoundingBox) | DestroyBlocksInAABB(DragonPartBody.BoundingBox); } }
/// <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> /// Applies a velocity to each of the entities pushing them away from each other. Args: entity /// </summary> public override void ApplyEntityCollision(Entity par1Entity) { if (WorldObj.IsRemote) { return; } if (par1Entity == RiddenByEntity) { return; } if ((par1Entity is EntityLiving) && !(par1Entity is EntityPlayer) && !(par1Entity is EntityIronGolem) && MinecartType == 0 && MotionX * MotionX + MotionZ * MotionZ > 0.01D && RiddenByEntity == null && par1Entity.RidingEntity == null) { par1Entity.MountEntity(this); } float d = par1Entity.PosX - PosX; float d1 = par1Entity.PosZ - PosZ; float d2 = d * d + d1 * d1; //JAVA TO C# CONVERTER TODO TASK: Octal literals cannot be represented in C#: if (d2 >= 9.9999997473787516E-005D) { d2 = MathHelper2.Sqrt_double(d2); d /= d2; d1 /= d2; float d3 = 1.0F / d2; if (d3 > 1.0F) { d3 = 1.0F; } d *= d3; d1 *= d3; d *= 0.10000000149011612F; d1 *= 0.10000000149011612F; d *= 1.0F - EntityCollisionReduction; d1 *= 1.0F - EntityCollisionReduction; d *= 0.5F; d1 *= 0.5F; if (par1Entity is EntityMinecart) { double d4 = par1Entity.PosX - PosX; double d5 = par1Entity.PosZ - PosZ; Vec3D vec3d = Vec3D.CreateVector(d4, 0.0F, d5).Normalize(); Vec3D vec3d1 = Vec3D.CreateVector(MathHelper2.Cos((RotationYaw * (float)Math.PI) / 180F), 0.0F, MathHelper2.Sin((RotationYaw * (float)Math.PI) / 180F)).Normalize(); double d6 = Math.Abs(vec3d.DotProduct(vec3d1)); if (d6 < 0.80000001192092896D) { return; } float d7 = par1Entity.MotionX + MotionX; float d8 = par1Entity.MotionZ + MotionZ; if (((EntityMinecart)par1Entity).MinecartType == 2 && MinecartType != 2) { MotionX *= 0.20000000298023224F; MotionZ *= 0.20000000298023224F; AddVelocity(par1Entity.MotionX - d, 0.0F, par1Entity.MotionZ - d1); par1Entity.MotionX *= 0.94999998807907104F; par1Entity.MotionZ *= 0.94999998807907104F; } else if (((EntityMinecart)par1Entity).MinecartType != 2 && MinecartType == 2) { par1Entity.MotionX *= 0.20000000298023224F; par1Entity.MotionZ *= 0.20000000298023224F; par1Entity.AddVelocity(MotionX + d, 0.0F, MotionZ + d1); MotionX *= 0.94999998807907104F; MotionZ *= 0.94999998807907104F; } else { d7 /= 2F; d8 /= 2F; MotionX *= 0.20000000298023224F; MotionZ *= 0.20000000298023224F; AddVelocity(d7 - d, 0.0F, d8 - d1); par1Entity.MotionX *= 0.20000000298023224F; par1Entity.MotionZ *= 0.20000000298023224F; par1Entity.AddVelocity(d7 + d, 0.0F, d8 + d1); } } else { AddVelocity(-d, 0.0F, -d1); par1Entity.AddVelocity(d / 4F, 0.0F, d1 / 4F); } } }
/// <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; } }