public virtual void DoRenderArrow(EntityArrow par1EntityArrow, double par2, double par4, double par6, float par8, float par9) { LoadTexture("/item/arrows.png"); //GL.PushMatrix(); //GL.Translate((float)par2, (float)par4, (float)par6); //GL.Rotate((par1EntityArrow.PrevRotationYaw + (par1EntityArrow.RotationYaw - par1EntityArrow.PrevRotationYaw) * par9) - 90F, 0.0F, 1.0F, 0.0F); //GL.Rotate(par1EntityArrow.PrevRotationPitch + (par1EntityArrow.RotationPitch - par1EntityArrow.PrevRotationPitch) * par9, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.Instance; int i = 0; float f = 0.0F; float f1 = 0.5F; float f2 = (float)(0 + i * 10) / 32F; float f3 = (float)(5 + i * 10) / 32F; float f4 = 0.0F; float f5 = 0.15625F; float f6 = (float)(5 + i * 10) / 32F; float f7 = (float)(10 + i * 10) / 32F; float f8 = 0.05625F; //GL.Enable(EnableCap.RescaleNormal); float f9 = (float)par1EntityArrow.ArrowShake - par9; if (f9 > 0.0F) { float f10 = -MathHelper2.Sin(f9 * 3F) * f9; //GL.Rotate(f10, 0.0F, 0.0F, 1.0F); } //GL.Rotate(45F, 1.0F, 0.0F, 0.0F); //GL.Scale(f8, f8, f8); //GL.Translate(-4F, 0.0F, 0.0F); //GL.Normal3(f8, 0.0F, 0.0F); tessellator.StartDrawingQuads(); tessellator.AddVertexWithUV(-7D, -2D, -2D, f4, f6); tessellator.AddVertexWithUV(-7D, -2D, 2D, f5, f6); tessellator.AddVertexWithUV(-7D, 2D, 2D, f5, f7); tessellator.AddVertexWithUV(-7D, 2D, -2D, f4, f7); tessellator.Draw(); //GL.Normal3(-f8, 0.0F, 0.0F); tessellator.StartDrawingQuads(); tessellator.AddVertexWithUV(-7D, 2D, -2D, f4, f6); tessellator.AddVertexWithUV(-7D, 2D, 2D, f5, f6); tessellator.AddVertexWithUV(-7D, -2D, 2D, f5, f7); tessellator.AddVertexWithUV(-7D, -2D, -2D, f4, f7); tessellator.Draw(); for (int j = 0; j < 4; j++) { //GL.Rotate(90F, 1.0F, 0.0F, 0.0F); //GL.Normal3(0.0F, 0.0F, f8); tessellator.StartDrawingQuads(); tessellator.AddVertexWithUV(-8D, -2D, 0.0F, f, f2); tessellator.AddVertexWithUV(8D, -2D, 0.0F, f1, f2); tessellator.AddVertexWithUV(8D, 2D, 0.0F, f1, f3); tessellator.AddVertexWithUV(-8D, 2D, 0.0F, f, f3); tessellator.Draw(); } //GL.Disable(EnableCap.RescaleNormal); //GL.PopMatrix(); }
/// <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 < Tentacles.Length; i++) { Tentacles[i].RotateAngleX = 0.2F * MathHelper2.Sin(par3 * 0.3F + (float)i) + 0.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) { 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); }
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 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; } }
/// <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); }
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> /// Called to update the entity's position/logic. /// </summary> public override void OnUpdate() { base.OnUpdate(); Field_25054_c = Field_25048_b; if (LooksWithInterest) { Field_25048_b = Field_25048_b + (1.0F - Field_25048_b) * 0.4F; } else { Field_25048_b = Field_25048_b + (0.0F - Field_25048_b) * 0.4F; } if (LooksWithInterest) { NumTicksToChaseTarget = 10; } if (IsWet()) { IsShaking = true; Field_25052_g = false; TimeWolfIsShaking = 0.0F; PrevTimeWolfIsShaking = 0.0F; } else if ((IsShaking || Field_25052_g) && Field_25052_g) { if (TimeWolfIsShaking == 0.0F) { WorldObj.PlaySoundAtEntity(this, "mob.wolf.shake", GetSoundVolume(), (Rand.NextFloat() - Rand.NextFloat()) * 0.2F + 1.0F); } PrevTimeWolfIsShaking = TimeWolfIsShaking; TimeWolfIsShaking += 0.05F; if (PrevTimeWolfIsShaking >= 2.0F) { IsShaking = false; Field_25052_g = false; PrevTimeWolfIsShaking = 0.0F; TimeWolfIsShaking = 0.0F; } if (TimeWolfIsShaking > 0.4F) { float f = (float)BoundingBox.MinY; int i = (int)(MathHelper2.Sin((TimeWolfIsShaking - 0.4F) * (float)Math.PI) * 7F); for (int j = 0; j < i; j++) { float f1 = (Rand.NextFloat() * 2.0F - 1.0F) * Width * 0.5F; float f2 = (Rand.NextFloat() * 2.0F - 1.0F) * Width * 0.5F; WorldObj.SpawnParticle("splash", PosX + (double)f1, f + 0.8F, PosZ + (double)f2, MotionX, MotionY, MotionZ); } } } }
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> /// 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) { 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) { 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; }
public virtual float GetShakeAngle(float par1, float par2) { float f = (PrevTimeWolfIsShaking + (TimeWolfIsShaking - PrevTimeWolfIsShaking) * par1 + par2) / 1.8F; if (f < 0.0F) { f = 0.0F; } else if (f > 1.0F) { f = 1.0F; } return(MathHelper2.Sin(f * (float)Math.PI) * MathHelper2.Sin(f * (float)Math.PI * 11F) * 0.15F * (float)Math.PI); }
/// <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 = (MathHelper2.Sin(par1 * 0.02F) * 0.1F + 1.25F) * par4; CoverRight.RotateAngleY = (float)Math.PI + f; CoverLeft.RotateAngleY = -f; PagesRight.RotateAngleY = f; PagesLeft.RotateAngleY = -f; FlippingPageRight.RotateAngleY = f - f * 2.0F * par2; FlippingPageLeft.RotateAngleY = f - f * 2.0F * par3; PagesRight.RotationPointX = MathHelper2.Sin(f); PagesLeft.RotationPointX = MathHelper2.Sin(f); FlippingPageRight.RotationPointX = MathHelper2.Sin(f); FlippingPageLeft.RotationPointX = MathHelper2.Sin(f); }
/// <summary> /// Draws the screen and all the components in it. /// </summary> public override void DrawScreen(int par1, int par2, float par3) { DrawDefaultBackground(); bool flag = !Mc.TheWorld.QuickSaveWorld(UpdateCounter2++); if (flag || UpdateCounter < 20) { float f = ((float)(UpdateCounter % 10) + par3) / 10F; f = MathHelper2.Sin(f * (float)Math.PI * 2.0F) * 0.2F + 0.8F; int i = (int)(255F * f); DrawString(FontRenderer, "Saving level..", 8, Height - 16, i << 16 | i << 8 | i); } DrawCenteredString(FontRenderer, "Game menu", Width / 2, 40, 0xffffff); base.DrawScreen(par1, par2, par3); }
public virtual float Func_44002_d(float par1) { if (SheepTimer > 4 && SheepTimer <= 36) { float f = ((float)(SheepTimer - 4) - par1) / 32F; return(((float)Math.PI / 5F) + ((float)Math.PI * 7F / 100F) * MathHelper2.Sin(f * 28.7F)); } if (SheepTimer > 0) { return((float)Math.PI / 5F); } else { return(RotationPitch / (180F / (float)Math.PI)); } }
public EntityNoteFX(World par1World, float par2, float par4, float par6, float par8, float par10, float par12, float par14) : base(par1World, par2, par4, par6, 0.0F, 0.0F, 0.0F) { MotionX *= 0.0099999997764825821F; MotionY *= 0.0099999997764825821F; MotionZ *= 0.0099999997764825821F; MotionY += 0.20000000000000001F; ParticleRed = MathHelper2.Sin(((float)par8 + 0.0F) * (float)Math.PI * 2.0F) * 0.65F + 0.35F; ParticleGreen = MathHelper2.Sin(((float)par8 + 0.3333333F) * (float)Math.PI * 2.0F) * 0.65F + 0.35F; ParticleBlue = MathHelper2.Sin(((float)par8 + 0.6666667F) * (float)Math.PI * 2.0F) * 0.65F + 0.35F; ParticleScale *= 0.75F; ParticleScale *= par14; NoteParticleScale = ParticleScale; ParticleMaxAge = 6; NoClip = false; SetParticleTextureIndex(64); }
public virtual void Func_35438_a(EntityXPOrb par1EntityXPOrb, double par2, double par4, double par6, float par8, float par9) { //GL.PushMatrix(); //GL.Translate((float)par2, (float)par4, (float)par6); int i = par1EntityXPOrb.GetTextureByXP(); LoadTexture("/item/xporb.png"); Tessellator tessellator = Tessellator.Instance; float f = (float)((i % 4) * 16 + 0) / 64F; float f1 = (float)((i % 4) * 16 + 16) / 64F; float f2 = (float)((i / 4) * 16 + 0) / 64F; float f3 = (float)((i / 4) * 16 + 16) / 64F; float f4 = 1.0F; float f5 = 0.5F; float f6 = 0.25F; int i7 = par1EntityXPOrb.GetBrightnessForRender(par9); float f8 = i7 % 0x10000; int j = i7 / 0x10000; OpenGlHelper.SetLightmapTextureCoords(OpenGlHelper.LightmapTexUnit, (float)f8 / 1.0F, (float)j / 1.0F); //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F); float f7 = 255F; f8 = ((float)par1EntityXPOrb.XpColor + par9) / 2.0F; j = (int)((MathHelper2.Sin(f8 + 0.0F) + 1.0F) * 0.5F * f7); int k = (int)f7; int l = (int)((MathHelper2.Sin(f8 + 4.18879F) + 1.0F) * 0.1F * f7); int i1 = j << 16 | k << 8 | l; //GL.Rotate(180F - RenderManager.PlayerViewY, 0.0F, 1.0F, 0.0F); //GL.Rotate(-RenderManager.PlayerViewX, 1.0F, 0.0F, 0.0F); float f9 = 0.3F; //GL.Scale(f9, f9, f9); tessellator.StartDrawingQuads(); tessellator.SetColorRGBA_I(i1, 128); 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.Blend); //GL.Disable(EnableCap.RescaleNormal); //GL.PopMatrix(); }
/// <summary> /// Draws the screen and all the components in it. /// </summary> public override void DrawScreen(int par1, int par2, float par3) { RenderSkybox(par1, par2, par3); Tessellator tessellator = Tessellator.Instance; int c = 274; int i = Width / 2 - c / 2; sbyte byte0 = 30; DrawGradientRect(0, 0, Width, Height, 0x80fffff, 0xffffff); DrawGradientRect(0, 0, Width, Height, 0, 0x8000000); //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTexture("title.mclogo.png")); RenderEngine.Instance.BindTexture("title.mclogo.png"); //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F); if ((double)UpdateCounter < 0.0001D) { DrawTexturedModalRect(i + 0, byte0 + 0, 0, 0, 99, 44); DrawTexturedModalRect(i + 99, byte0 + 0, 129, 0, 27, 44); DrawTexturedModalRect(i + 99 + 26, byte0 + 0, 126, 0, 3, 44); DrawTexturedModalRect(i + 99 + 26 + 3, byte0 + 0, 99, 0, 26, 44); DrawTexturedModalRect(i + 155, byte0 + 0, 0, 45, 155, 44); } else { DrawTexturedModalRect(i + 0, byte0 + 0, 0, 0, 155, 44); DrawTexturedModalRect(i + 155, byte0 + 0, 0, 45, 155, 44); } /* * tessellator.SetColorOpaque_I(0xffffff); * GL.PushMatrix(); * GL.Translate(Width / 2 + 90, 70F, 0.0F); * GL.Rotate(-20F, 0.0F, 0.0F, 1.0F);*/ float f = 1.8F - MathHelper2.Abs(MathHelper2.Sin(((float)(JavaHelper.CurrentTimeMillis() % 1000L) / 1000F) * (float)Math.PI * 2.0F) * 0.1F); f = (f * 100F) / (float)(FontRenderer.GetStringWidth(SplashText) + 32); //GL.Scale(f, f, f); DrawCenteredString(FontRenderer, SplashText, 300, 80, 0xffff00); //GL.PopMatrix(); DrawString(FontRenderer, Minecraft.GetMinecraftTitle(), 2, Height - FontRenderer.FontHeight, 0xffffff); string s = "Copyright Mojang AB. Do not distribute!"; DrawString(FontRenderer, s, Width - (int)FontRenderer.GetStringWidth(s) - 2, Height - FontRenderer.FontHeight, 0xffffff); base.DrawScreen(par1, par2, par3); }
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); 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 virtual void Func_41035_a(EntityEnderCrystal par1EntityEnderCrystal, double par2, double par4, double par6, float par8, float par9) { if (Field_41037_a != 1) { Field_41036_b = new ModelEnderCrystal(0.0F); Field_41037_a = 1; } float f = (float)par1EntityEnderCrystal.InnerRotation + par9; //GL.PushMatrix(); //GL.Translate((float)par2, (float)par4, (float)par6); LoadTexture("/mob/enderdragon/crystal.png"); float f1 = MathHelper2.Sin(f * 0.2F) / 2.0F + 0.5F; f1 = f1 * f1 + f1; Field_41036_b.Render(par1EntityEnderCrystal, 0.0F, f * 3F, f1 * 0.2F, 0.0F, 0.0F, 0.0625F); //GL.PopMatrix(); }
/// <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); } }
/// <summary> /// Updates creeper scale in prerender callback /// </summary> protected virtual void UpdateCreeperScale(EntityCreeper par1EntityCreeper, float par2) { EntityCreeper entitycreeper = par1EntityCreeper; float f = entitycreeper.SetCreeperFlashTime(par2); float f1 = 1.0F + MathHelper2.Sin(f * 100F) * f * 0.01F; if (f < 0.0F) { f = 0.0F; } if (f > 1.0F) { f = 1.0F; } f *= f; f *= f; float f2 = (1.0F + f * 0.4F) * f1; float f3 = (1.0F + f * 0.1F) / f1; //GL.Scale(f2, f3, f2); }
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> /// 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(); }
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); }