Skip to content

Commit 0c2a9d9

Browse files
authored
Fix #76 litematic bit packing (#77)
1 parent e44f468 commit 0c2a9d9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/editor/Schematics.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ export function litematicToStructure(root: NbtCompound) {
7979
return tempDataview.getBigUint64(0)
8080
})
8181

82-
const bits = Math.ceil(Math.log2(palette.length)) // unlike chunks, bits is not at least 4
82+
// litematica use at least 2 bits for palette indices (https://github.com/misode/vscode-nbt/issues/76)
83+
const bits = Math.max(2, Math.ceil(Math.log2(palette.length)))
8384
const bigBits = BigInt(bits)
8485
const big0 = BigInt(0)
8586
const big64 = BigInt(64)

0 commit comments

Comments
 (0)