public override void HandlePacket(MinecraftServer server, MinecraftClient client) { if (!client.ReadyToSpawn) return; client.Entity.FoodExhaustion += (float)client.Entity.GivenPosition.DistanceTo(new Vector3(X, Y, Z)) * (client.Entity.IsSprinting ? 0.1f : 0.01f); // TODO: Swimming client.Entity.GivenPosition = new Vector3(X, Y, Z); client.Entity.Pitch = Pitch; client.Entity.Yaw = Yaw; client.UpdateChunksAsync(); server.ProcessSendQueue(); }
public static void PlayerPosition(MinecraftClient client, MinecraftServer server, IPacket _packet) { var packet = (PlayerPositionPacket)_packet; client.Entity.FoodExhaustion += (float)client.Entity.GivenPosition.DistanceTo( new Vector3(packet.X, packet.Y, packet.Z)) * (client.Entity.IsSprinting ? 0.1f : 0.01f); // TODO: Swimming if ((packet.Y - client.Entity.GivenPosition.Y) > 0) client.Entity.PositiveDeltaY += (packet.Y - client.Entity.GivenPosition.Y); else client.Entity.PositiveDeltaY = 0; client.Entity.GivenPosition = new Vector3(packet.X, packet.Y, packet.Z); client.UpdateChunksAsync(); }
public override void HandlePacket(MinecraftServer Server, ref MinecraftClient Client) { if (!Client.ReadyToSpawn) return; Client.Entity.Position = new Vector3(X, Y, Z); if (Client.Entity.Position.DistanceTo(Client.Entity.OldPosition) > Client.MaxMoveDistance) { Client.SendPacket(new DisconnectPacket("Hacking: You moved too fast!")); Server.ProcessSendQueue(); return; } Client.UpdateChunksAsync(); Server.GetClientWorld(Client).EntityManager.UpdateEntity(Client.Entity); Server.ProcessSendQueue(); }
public override void HandlePacket(MinecraftServer server, MinecraftClient client) { if (!client.ReadyToSpawn) return; client.Entity.Position = new Vector3(X, Y, Z); if (client.Entity.Position.DistanceTo(client.Entity.OldPosition) > client.MaxMoveDistance) { client.SendPacket(new DisconnectPacket("Hacking: You moved too fast!")); server.ProcessSendQueue(); return; } client.UpdateChunksAsync(); server.ProcessSendQueue(); server.EntityManager.UpdateEntity(client.Entity); }
public static void PlayerPosition(MinecraftClient client, MinecraftServer server, IPacket _packet) { var packet = (PlayerPositionPacket)_packet; client.Entity.FoodExhaustion += (float)client.Entity.GivenPosition.DistanceTo( new Vector3(packet.X, packet.Y, packet.Z)) * (client.Entity.IsSprinting ? 0.1f : 0.01f); // TODO: Swimming if ((packet.Y - client.Entity.GivenPosition.Y) > 0) { client.Entity.PositiveDeltaY += (packet.Y - client.Entity.GivenPosition.Y); } else { client.Entity.PositiveDeltaY = 0; } client.Entity.GivenPosition = new Vector3(packet.X, packet.Y, packet.Z); client.UpdateChunksAsync(); }