Exemplo n.º 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);
            }
        }