public virtual void DoRenderFireball(EntityFireball par1EntityFireball, double par2, double par4, double par6, float par8, float par9) { //GL.PushMatrix(); //GL.Translate((float)par2, (float)par4, (float)par6); //GL.Enable(EnableCap.RescaleNormal); float f = Field_40269_a; //GL.Scale(f / 1.0F, f / 1.0F, f / 1.0F); sbyte byte0 = 46; LoadTexture("/gui/items.png"); Tessellator tessellator = Tessellator.Instance; float f1 = (float)((byte0 % 16) * 16 + 0) / 256F; float f2 = (float)((byte0 % 16) * 16 + 16) / 256F; float f3 = (float)((byte0 / 16) * 16 + 0) / 256F; float f4 = (float)((byte0 / 16) * 16 + 16) / 256F; float f5 = 1.0F; float f6 = 0.5F; float f7 = 0.25F; //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 - f6, 0.0F - f7, 0.0F, f1, f4); tessellator.AddVertexWithUV(f5 - f6, 0.0F - f7, 0.0F, f2, f4); tessellator.AddVertexWithUV(f5 - f6, 1.0F - f7, 0.0F, f2, f3); tessellator.AddVertexWithUV(0.0F - f6, 1.0F - f7, 0.0F, f1, f3); tessellator.Draw(); //GL.Disable(EnableCap.RescaleNormal); //GL.PopMatrix(); }
public override void UpdateEntityActionState() { if (!WorldObj.IsRemote && WorldObj.DifficultySetting == 0) { SetDead(); } DespawnEntity(); PrevAttackCounter = AttackCounter; float d = WaypointX - PosX; float d1 = WaypointY - PosY; float d2 = WaypointZ - PosZ; float d3 = (float)MathHelper2.Sqrt_double(d * d + d1 * d1 + d2 * d2); if (d3 < 1.0D || d3 > 60D) { WaypointX = PosX + ((Rand.NextFloat() * 2.0F - 1.0F) * 16F); WaypointY = PosY + ((Rand.NextFloat() * 2.0F - 1.0F) * 16F); WaypointZ = PosZ + ((Rand.NextFloat() * 2.0F - 1.0F) * 16F); } if (CourseChangeCooldown-- <= 0) { CourseChangeCooldown += Rand.Next(5) + 2; if (IsCourseTraversable(WaypointX, WaypointY, WaypointZ, d3)) { MotionX += (d / d3) * 0.10000000000000001F; MotionY += (d1 / d3) * 0.10000000000000001F; MotionZ += (d2 / d3) * 0.10000000000000001F; } else { WaypointX = PosX; WaypointY = PosY; WaypointZ = PosZ; } } if (TargetedEntity != null && TargetedEntity.IsDead) { TargetedEntity = null; } if (TargetedEntity == null || AggroCooldown-- <= 0) { TargetedEntity = WorldObj.GetClosestVulnerablePlayerToEntity(this, 100); if (TargetedEntity != null) { AggroCooldown = 20; } } double d4 = 64D; if (TargetedEntity != null && TargetedEntity.GetDistanceSqToEntity(this) < d4 * d4) { float d5 = TargetedEntity.PosX - PosX; float d6 = (TargetedEntity.BoundingBox.MinY + TargetedEntity.Height / 2.0F) - PosY + (Height / 2.0F); float d7 = TargetedEntity.PosZ - PosZ; RenderYawOffset = RotationYaw = (-(float)Math.Atan2(d5, d7) * 180F) / (float)Math.PI; if (CanEntityBeSeen(TargetedEntity)) { if (AttackCounter == 10) { WorldObj.PlayAuxSFXAtEntity(null, 1007, (int)PosX, (int)PosY, (int)PosZ, 0); } AttackCounter++; if (AttackCounter == 20) { WorldObj.PlayAuxSFXAtEntity(null, 1008, (int)PosX, (int)PosY, (int)PosZ, 0); EntityFireball entityfireball = new EntityFireball(WorldObj, this, d5, d6, d7); float d8 = 4; Vec3D vec3d = GetLook(1.0F); entityfireball.PosX = PosX + (float)vec3d.XCoord * d8; entityfireball.PosY = PosY + (Height / 2.0F) + 0.5F; entityfireball.PosZ = PosZ + (float)vec3d.ZCoord * d8; WorldObj.SpawnEntityInWorld(entityfireball); AttackCounter = -40; } } else if (AttackCounter > 0) { AttackCounter--; } } else { RenderYawOffset = RotationYaw = (-(float)Math.Atan2(MotionX, MotionZ) * 180F) / (float)Math.PI; if (AttackCounter > 0) { AttackCounter--; } } if (!WorldObj.IsRemote) { byte byte0 = DataWatcher.GetWatchableObjectByte(16); byte byte1 = (byte)(AttackCounter <= 10 ? 0 : 1); if (byte0 != byte1) { DataWatcher.UpdateObject(16, byte1); } } }
public override void HandleVehicleSpawn(Packet23VehicleSpawn par1Packet23VehicleSpawn) { float d = par1Packet23VehicleSpawn.XPosition / 3F; float d1 = par1Packet23VehicleSpawn.YPosition / 3F; float d2 = par1Packet23VehicleSpawn.ZPosition / 3F; Entity obj = null; if (par1Packet23VehicleSpawn.Type == 10) { obj = new EntityMinecart(WorldClient, d, d1, d2, 0); } else if (par1Packet23VehicleSpawn.Type == 11) { obj = new EntityMinecart(WorldClient, d, d1, d2, 1); } else if (par1Packet23VehicleSpawn.Type == 12) { obj = new EntityMinecart(WorldClient, d, d1, d2, 2); } else if (par1Packet23VehicleSpawn.Type == 90) { obj = new EntityFishHook(WorldClient, d, d1, d2); } else if (par1Packet23VehicleSpawn.Type == 60) { obj = new EntityArrow(WorldClient, d, d1, d2); } else if (par1Packet23VehicleSpawn.Type == 61) { obj = new EntitySnowball(WorldClient, d, d1, d2); } else if (par1Packet23VehicleSpawn.Type == 65) { obj = new EntityEnderPearl(WorldClient, d, d1, d2); } else if (par1Packet23VehicleSpawn.Type == 72) { obj = new EntityEnderEye(WorldClient, d, d1, d2); } else if (par1Packet23VehicleSpawn.Type == 63) { obj = new EntityFireball(WorldClient, d, d1, d2, par1Packet23VehicleSpawn.SpeedX / 8000F, par1Packet23VehicleSpawn.SpeedY / 8000F, par1Packet23VehicleSpawn.SpeedZ / 8000F); par1Packet23VehicleSpawn.ThrowerEntityId = 0; } else if (par1Packet23VehicleSpawn.Type == 64) { obj = new EntitySmallFireball(WorldClient, d, d1, d2, par1Packet23VehicleSpawn.SpeedX / 8000F, par1Packet23VehicleSpawn.SpeedY / 8000F, par1Packet23VehicleSpawn.SpeedZ / 8000F); par1Packet23VehicleSpawn.ThrowerEntityId = 0; } else if (par1Packet23VehicleSpawn.Type == 62) { obj = new EntityEgg(WorldClient, d, d1, d2); } else if (par1Packet23VehicleSpawn.Type == 73) { obj = new EntityPotion(WorldClient, d, d1, d2, par1Packet23VehicleSpawn.ThrowerEntityId); par1Packet23VehicleSpawn.ThrowerEntityId = 0; } else if (par1Packet23VehicleSpawn.Type == 75) { obj = new EntityExpBottle(WorldClient, d, d1, d2); par1Packet23VehicleSpawn.ThrowerEntityId = 0; } else if (par1Packet23VehicleSpawn.Type == 1) { obj = new EntityBoat(WorldClient, d, d1, d2); } else if (par1Packet23VehicleSpawn.Type == 50) { obj = new EntityTNTPrimed(WorldClient, d, d1, d2); } else if (par1Packet23VehicleSpawn.Type == 51) { obj = new EntityEnderCrystal(WorldClient, d, d1, d2); } else if (par1Packet23VehicleSpawn.Type == 70) { obj = new EntityFallingSand(WorldClient, d, d1, d2, Block.Sand.BlockID); } else if (par1Packet23VehicleSpawn.Type == 71) { obj = new EntityFallingSand(WorldClient, d, d1, d2, Block.Gravel.BlockID); } else if (par1Packet23VehicleSpawn.Type == 74) { obj = new EntityFallingSand(WorldClient, d, d1, d2, Block.DragonEgg.BlockID); } if (obj != null) { obj.ServerPosX = par1Packet23VehicleSpawn.XPosition; obj.ServerPosY = par1Packet23VehicleSpawn.YPosition; obj.ServerPosZ = par1Packet23VehicleSpawn.ZPosition; obj.RotationYaw = 0.0F; obj.RotationPitch = 0.0F; Entity[] aentity = ((Entity)(obj)).GetParts(); if (aentity != null) { int i = par1Packet23VehicleSpawn.EntityId - ((Entity)(obj)).EntityId; for (int j = 0; j < aentity.Length; j++) { aentity[j].EntityId += i; } } obj.EntityId = par1Packet23VehicleSpawn.EntityId; WorldClient.AddEntityToWorld(par1Packet23VehicleSpawn.EntityId, ((Entity)(obj))); if (par1Packet23VehicleSpawn.ThrowerEntityId > 0) { if (par1Packet23VehicleSpawn.Type == 60) { Entity entity = GetEntityByID(par1Packet23VehicleSpawn.ThrowerEntityId); if (entity is EntityLiving) { ((EntityArrow)obj).ShootingEntity = (EntityLiving)entity; } } ((Entity)(obj)).SetVelocity(par1Packet23VehicleSpawn.SpeedX / 8000F, par1Packet23VehicleSpawn.SpeedY / 8000F, par1Packet23VehicleSpawn.SpeedZ / 8000F); } } }