import PChunk from 'prismarine-chunk'
import { Vec3 } from 'vec3'
const Chunk = PChunk('1.18.1')
const chunk = new Chunk(undefined)
const chunk2 = Chunk.fromJson(chunk.toJson()) as any
for (let i = 0; i < 4096; i++) {
chunk2.setBlockStateId(new Vec3(0, 0, 0), i) // Decides to switch to Direct pallete at some point
const blockStateId = chunk2.getBlockStateId(new Vec3(0, 0, 0))
if (blockStateId !== i) throw new Error(`Expected ${i} but got ${blockStateId}`) // Expected 256 but got 0
}
Also what about indirect pallete I don't really know what is the correct behavior but it just feels like always adding a new block into pallete on the block replace is not right (since the block doesn't exist in chunk anymore).
Fixes the following code:
Also what about indirect pallete I don't really know what is the correct behavior but it just feels like always adding a new block into pallete on the block replace is not right (since the block doesn't exist in chunk anymore).