コード例 #1
0
        public byte[] Export()
        {
            var buffer = new MSGBuffer(new byte[0]);

            buffer.WriteInt(Blocks.Length);

            for (var i = 0; i < Blocks.Length; i++)
            {
                buffer.WriteUShort(Blocks[i]);
            }

            buffer.WriteInt(Blocks.Length);
            for (var i = 0; i < Blocks.Length; i++)
            {
                buffer.WriteUShort((ushort)Metadata[i]);
            }

            buffer.WriteInt(Blocklight.Data.Length);
            buffer.Write(Blocklight.Data);

            buffer.WriteInt(Skylight.Data.Length);
            buffer.Write(Skylight.Data);

            buffer.WriteInt(BiomeId.Length);
            buffer.Write(BiomeId);

            return(buffer.ExportWriter);
        }
コード例 #2
0
        public byte[] GetBytes(bool unloader = false)
        {
            var writer = new MSGBuffer(new byte[0]);

            if (!unloader)
            {
                writer.WriteInt(X);
                writer.WriteInt(Z);
                writer.WriteBool(true);
                writer.WriteUShort(0xffff);                 // bitmap
                writer.WriteVarInt((Blocks.Length * 2) + Skylight.Data.Length + Blocklight.Data.Length + BiomeId.Length);

                for (var i = 0; i < Blocks.Length; i++)
                {
                    //if (i == null) writer.WriteUShort((0 << 4) | 0);
                    writer.WriteUShort((ushort)((Blocks[i] << 4) | Metadata[i]));
                }

                writer.Write(Blocklight.Data);
                writer.Write(Skylight.Data);

                writer.Write(BiomeId);
            }
            else
            {
                writer.WriteInt(X);
                writer.WriteInt(Z);
                writer.WriteBool(true);
                writer.WriteUShort(0);
                writer.WriteVarInt(0);
            }
            return(writer.ExportWriter);
        }
コード例 #3
0
 public void Write(ClientWrapper state, MSGBuffer buffer, object[] Arguments)
 {
     buffer.WriteVarInt(PacketID);
     buffer.Write((byte[])Arguments[0]);
     buffer.FlushData();
 }