Beispiel #1
0
        public byte[] GetBytes(bool unloader = false)
        {
            var writer = new DataBuffer(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++)
                {
                    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;
        }
Beispiel #2
0
        public byte[] Export()
        {
            var buffer = new DataBuffer(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;
        }