public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Action = (PlayerListAction)reader.ReadVarInt();
            Length = reader.ReadVarInt();
            UUID   = reader.ReadBigInteger();

            switch (Action)
            {
            case PlayerListAction.AddPlayer:
                PlayerList = new PlayerListActionAddPlayer().FromReader(reader);
                break;

            case PlayerListAction.UpdateGamemode:
                PlayerList = new PlayerListActionUpdateGamemode().FromReader(reader);
                break;

            case PlayerListAction.UpdateLatency:
                PlayerList = new PlayerListActionUpdateLatency().FromReader(reader);
                break;

            case PlayerListAction.UpdateDisplayName:
                PlayerList = new PlayerListActionUpdateDisplayName().FromReader(reader);
                break;

            case PlayerListAction.RemovePlayer:
                PlayerList = new PlayerListActionRemovePlayer().FromReader(reader);
                break;
            }

            return(this);
        }
示例#2
0
        public static EntityPropertyList FromReader(IMinecraftDataReader reader)
        {
            var count = reader.ReadInt();

            var value = new EntityPropertyList();

            for (int i = 0; i < count; i++)
            {
                var property = new EntityProperty();

                property.Key   = reader.ReadString();
                property.Value = (float)reader.ReadDouble();
                var listLength = reader.ReadVarInt();

                property.Modifiers = new Modifiers[listLength];
                for (var j = 0; j < listLength; j++)
                {
                    var item = new Modifiers
                    {
                        UUID      = reader.ReadBigInteger(),
                        Amount    = (float)reader.ReadDouble(),
                        Operation = reader.ReadSByte()
                    };

                    property.Modifiers[j] = item;
                }

                value[i] = property;
            }

            return(value);
        }
示例#3
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID       = reader.ReadVarInt();
            PlayerUUID     = reader.ReadBigInteger();
            Vector3        = Vector3.FromReaderIntFixedPoint(reader);
            Yaw            = reader.ReadSByte();
            Pitch          = reader.ReadSByte();
            CurrentItem    = reader.ReadShort();
            EntityMetadata = EntityMetadataList.FromReader(reader);

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            PlayerUUID = reader.ReadBigInteger();
            Vector3 = Vector3.FromReaderIntFixedPoint(reader);
            Yaw = reader.ReadSByte();
            Pitch = reader.ReadSByte();
            CurrentItem = reader.ReadShort();
            EntityMetadata = EntityMetadataList.FromReader(reader);

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Action = (PlayerListAction) reader.ReadVarInt();
            Length = reader.ReadVarInt();
            UUID = reader.ReadBigInteger();

            switch (Action)
            {
                case PlayerListAction.AddPlayer:
                    PlayerList = new PlayerListActionAddPlayer().FromReader(reader);
                    break;
                case PlayerListAction.UpdateGamemode:
                    PlayerList = new PlayerListActionUpdateGamemode().FromReader(reader);
                    break;
                case PlayerListAction.UpdateLatency:
                    PlayerList = new PlayerListActionUpdateLatency().FromReader(reader);
                    break;
                case PlayerListAction.UpdateDisplayName:
                    PlayerList = new PlayerListActionUpdateDisplayName().FromReader(reader);
                    break;
                case PlayerListAction.RemovePlayer:
                    PlayerList = new PlayerListActionRemovePlayer().FromReader(reader);
                    break;
            }

            return this;
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            UUID = reader.ReadBigInteger();

            return(this);
        }