Updated chunk handling

This commit is contained in:
mhsjlw 2015-08-23 11:20:57 -04:00
parent 6c39ef1b3f
commit 9e1d38329c

View file

@ -215,26 +215,11 @@ World.prototype.packMapChunkBulk = function() {
metadatas.push(metadata); metadatas.push(metadata);
} }
// Deflate/compress the buffers cb(null, {
var deflate = zlib.createDeflate(); skyLightSent: true,
var deflateBuffer = new Buffer(0); meta: metadatas,
deflate.on('data', function(data) { data: Buffer.concat(bufs)
deflateBuffer = Buffer.concat([deflateBuffer, data]);
}); });
deflate.on('end', function() {
cb(null, {
data: {
skyLightSent: true,
meta: metadatas,
compressedChunkData: deflateBuffer
}});
});
deflate.on('error', function(err) {
console.log("error");
cb(err);
});
deflate.write(Buffer.concat(bufs));
deflate.end();
} }
World.prototype.get = function(x, y, z, key) { World.prototype.get = function(x, y, z, key) {