public void Save(Stream stream, Game game)
        {
            using (GZipStream wrapper = new GZipStream(stream, CompressionMode.Compress)) {
                writer    = new BinaryWriter(wrapper);
                nbt       = new NbtFile(writer);
                this.game = game;
                map       = game.World;

                nbt.Write(NbtTagType.Compound); nbt.Write("ClassicWorld");

                nbt.Write(NbtTagType.Int8);
                nbt.Write("FormatVersion"); nbt.WriteInt8(1);

                nbt.Write(NbtTagType.Int8Array);
                nbt.Write("UUID"); nbt.WriteInt32(16);
                nbt.WriteBytes(map.Uuid.ToByteArray());

                nbt.Write(NbtTagType.Int16);
                nbt.Write("X"); nbt.WriteInt16((short)map.Width);

                nbt.Write(NbtTagType.Int16);
                nbt.Write("Y"); nbt.WriteInt16((short)map.Height);

                nbt.Write(NbtTagType.Int16);
                nbt.Write("Z"); nbt.WriteInt16((short)map.Length);

                WriteSpawnCompoundTag();

                nbt.Write(NbtTagType.Int8Array);
                nbt.Write("BlockArray"); nbt.WriteInt32(map.blocks.Length);
                                #if USE16_BIT
                nbt.WriteBytes(Utils.UInt16sToUInt8s(map.blocks));
                                #else
                nbt.WriteBytes(map.blocks);
                                #endif

                WriteMetadata();

                nbt.Write(NbtTagType.End);
            }
        }
        public void Save( Stream stream, Game game )
        {
            using( GZipStream wrapper = new GZipStream( stream, CompressionMode.Compress ) ) {
                writer = new BinaryWriter( wrapper );
                nbt = new NbtFile( writer );
                this.game = game;
                map = game.World;

                nbt.Write( NbtTagType.Compound ); nbt.Write( "ClassicWorld" );

                nbt.Write( NbtTagType.Int8 );
                nbt.Write( "FormatVersion" ); nbt.WriteInt8( 1 );

                nbt.Write( NbtTagType.Int8Array );
                nbt.Write( "UUID" ); nbt.WriteInt32( 16 );
                nbt.WriteBytes( map.Uuid.ToByteArray() );

                nbt.Write( NbtTagType.Int16 );
                nbt.Write( "X" ); nbt.WriteInt16( (short)map.Width );

                nbt.Write( NbtTagType.Int16 );
                nbt.Write( "Y" ); nbt.WriteInt16( (short)map.Height );

                nbt.Write( NbtTagType.Int16 );
                nbt.Write( "Z" ); nbt.WriteInt16( (short)map.Length );

                WriteSpawnCompoundTag();

                nbt.Write( NbtTagType.Int8Array );
                nbt.Write( "BlockArray" ); nbt.WriteInt32( map.blocks.Length );
                nbt.WriteBytes( map.blocks );

                WriteMetadata();

                nbt.Write( NbtTagType.End );
            }
        }