示例#1
0
        static void SpawnRaw(Player dst, byte id, Entity entity, Position pos, Orientation rot,
                             string skin, string name, string model)
        {
            // NOTE: Fix for standard clients
            if (id == Entities.SelfID)
            {
                pos.Y -= 22;
            }
            name = Colors.Cleanup(name, dst.hasTextColors);

            if (dst.Supports(CpeExt.ExtPlayerList, 2))
            {
                dst.Send(Packet.ExtAddEntity2(id, skin, name, pos, rot, dst.hasCP437, dst.hasExtPositions));
            }
            else if (dst.hasExtList)
            {
                dst.Send(Packet.ExtAddEntity(id, skin, name, dst.hasCP437));
                dst.Send(Packet.Teleport(id, pos, rot, dst.hasExtPositions));
            }
            else
            {
                dst.Send(Packet.AddEntity(id, name, pos, rot, dst.hasCP437, dst.hasExtPositions));
            }

            if (dst.hasChangeModel && !model.CaselessEq("humanoid"))
            {
                SendModel(dst, id, model);
            }
            if (dst.Supports(CpeExt.EntityProperty))
            {
                dst.Send(Packet.EntityProperty(id, EntityProp.RotX, Orientation.PackedToDegrees(rot.RotX)));
                dst.Send(Packet.EntityProperty(id, EntityProp.RotZ, Orientation.PackedToDegrees(rot.RotZ)));
                SendModelScales(dst, id, entity);
            }
        }
 /// <summary> Sends a packet indicating an absolute position + orientation change for an enity. </summary>
 public void SendPos(byte id, Position pos, Orientation rot)
 {
     if (id == Entities.SelfID)
     {
         Pos    = pos; SetYawPitch(rot.RotY, rot.HeadX);
         pos.Y -= 22;  // NOTE: Fix for standard clients
     }
     Send(Packet.Teleport(id, pos, rot, hasExtPositions));
 }
 /// <summary> Sends a packet indicating an absolute position + orientation change for this player. </summary>
 public void SendPosition(Position pos, Orientation rot)
 {
     pos.Y -= 22; // NOTE: Fix for standard clients
     Send(Packet.Teleport(Entities.SelfID, pos, rot, hasExtPositions));
 }