예제 #1
0
        public void Send(ref MinecraftClient client, GameStream stream)
        {
            // manually send this packet
            VarInt id     = (byte)Packet;
            VarInt length = 0;

            VarInt arrayLength = _stats.Length;

            length += arrayLength.Length;
            foreach (Statistic stat in _stats)
            {
                length += stat.Id.Length;
                length += stat.Value.Length;
                length += stat.Category.Length;
            }

            // write the packet info
            stream.WriteVarInt(length);
            stream.WriteVarInt(id);

            // Write the length
            stream.WriteVarInt(arrayLength);

            // write each item
            foreach (Statistic stat in _stats)
            {
                stream.WriteVarInt(stat.Category);
                stream.WriteVarInt(stat.Id);
                stream.WriteVarInt(stat.Value);
            }

            stream.Flush();
        }