Ejemplo n.º 1
0
        public void HandleEntityTeleport(MinecraftClient client, IPacket packet) {
            var myPacket = (CBEntityTeleport)packet;

            if (client.MinecraftWorld != null) {
                int eIndex = client.MinecraftWorld.GetEntityById(myPacket.EntityID);

                if (eIndex != -1) {
                    client.MinecraftWorld.Entities[eIndex].Location.x = myPacket.X;
                    client.MinecraftWorld.Entities[eIndex].Location.y = myPacket.Y;
                    client.MinecraftWorld.Entities[eIndex].Location.z = myPacket.Z;
                    client.MinecraftWorld.Entities[eIndex].yaw = myPacket.Yaw;
                    client.MinecraftWorld.Entities[eIndex].pitch = myPacket.Pitch;
                }
            }

            client.RaiseEntityTeleport(myPacket.EntityID, myPacket.X, myPacket.Y, myPacket.Z);
            client.RaiseEntityLookChanged(myPacket.EntityID, myPacket.Yaw, myPacket.Pitch);
        }