Skip to content

Instantly share code, notes, and snippets.

@rom1504
Created October 12, 2015 13:14
Show Gist options
  • Select an option

  • Save rom1504/f4626c3f7e994a37f63a to your computer and use it in GitHub Desktop.

Select an option

Save rom1504/f4626c3f7e994a37f63a to your computer and use it in GitHub Desktop.
testing chunk compression
var Chunk = require('prismarine-chunk')("1.8");
var Vec3 = require("vec3");
var chunk=new Chunk();
for (var x = 0; x < 16;x++) {
for (var z = 0; z < 16; z++) {
chunk.setBlockType(new Vec3(x, 50, z), 2);
for (var y = 0; y < 256; y++) {
chunk.setSkyLight(new Vec3(x, y, z), 15);
}
}
}
console.log(chunk.data.length);
var zlib = require("zlib");
zlib.deflate(chunk.data, function(err, newChunk) { console.log(newChunk.length); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment