Created
September 18, 2011 05:37
-
-
Save eddyb/1224773 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wc.Chunk = function(x, z, data) { | |
this.x = x / 16; | |
this.z = z / 16; | |
this.size = 16*128*16; | |
data = atob(data); | |
function byte(pos) { | |
return data.charCodeAt(pos); | |
} | |
function nibble(pos) { | |
var b = byte(Math.floor(pos/2)); | |
return (pos % 2) ? b >> 4 : b & 0xf; | |
} | |
this.data = []; | |
for(var i = 0; i < this.size; i++) | |
this.data[i] = /*type*/byte(i) | /*dataVal*/(nibble(this.size*2 + i) << 8) | /*light*/(nibble(this.size*3 + i) << 12) | /*skyLight*/(nibble(this.size*4 + i) << 16); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment