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
Block { | |
type: 9, | |
metadata: 0, | |
light: 0, | |
skyLight: 0, | |
biome: | |
Biome { | |
id: 0, | |
color: 112, | |
name: 'Ocean', |
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
packBlockData(rawdata, bitsPerBlock) | |
{ | |
let blockCount = Chunk.l * Chunk.w * 16; | |
let resultantBuffer = Buffer.alloc(blockCount * bitsPerBlock/8); | |
for (let block = 0; block < blockCount; block++) { | |
//Determine the start-bit for the block. | |
let bit = block * bitsPerBlock; | |
//Determine the start-byte for that bit. | |
let targetlong = Math.floor(bit/64); | |
//We write backwards from the end of the long. First, we determine the local writing start. |
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
dump() { | |
//OLD/INTERNAL FORMAT: | |
//The first w*l*h*2 bytes are blocks, each of which are shorts. | |
//After that, the first w*l*h*0.5 bytes are block-light-levels, each half-bytes. | |
//Next, the first w*l*h*0.5 bytes are sky-light-levels, each half-bytes. | |
//Finally, the next w*l bytes are biomes. | |
let outputBuffer = Buffer.alloc(0); | |
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
const fs=require("fs"); | |
var Chunk = require('prismarine-chunk')("1.8"); | |
var Vec3 = require("vec3"); | |
// based on http://wiki.vg/SMP_Map_Format#Format | |
// testing data from https://download.rom1504.fr/minecraft/chunks/chunks-1.9/ | |
// see http://lunarco.de/minecraft/chunks/ for explanations | |
// also see https://gist.github.com/Gjum/0375b643ec13a42ab3c0 | |
// and https://github.com/SpockBotMC/SpockBot/blob/0535c31/spockbot/plugins/tools/smpmap.py |