PrismarineJS/prismarine-chunk

How to read chunk for pe 0.14

codingwatching opened this issue · 3 comments

Hi,
I am trying to init like this to read the pe 0.14

const Chunk = require('prismarine-chunk')("0.14")

But I have an error:

No chunk implementation for 0.14 found

What is the right way to init and read the chunk data of pe 0.14?
Thank you!

u9g commented

const Chunk = require('prismarine-chunk')("pe_0.14")

Hi @u9g Awesome! It works!

Maybe the 0.14 is old version, so there are some error when running with latest example like this

const Chunk = require('prismarine-chunk')("pe_0.14")
const Vec3 = require("vec3")

const chunk=new Chunk()

for (let x = 0; x < 16;x++) {
  for (let z = 0; z < 16; z++) {
    chunk.setBlockType(new Vec3(x, 50, z), 2)
    for (let y = 0; y < 256; y++) {
      chunk.setSkyLight(new Vec3(x, y, z), 15)
    }
  }
}

console.log(JSON.stringify(chunk.getBlock(new Vec3(3,50,3)),null,2))

internal/buffer.js:83
  throw new ERR_OUT_OF_RANGE(type || 'offset',
  ^

RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 83199. Received 83200

should work