Skip to content

Commit f1c1f9a

Browse files
authored
Support for hashed block network ID's (#237)
* loadRuntimePalette for 1.18-latest * using block.stateId
1 parent eed7ca5 commit f1c1f9a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/bedrock/1.18/SubChunk.js

+10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ const { StorageType } = require('../common/constants')
33
const PalettedStorage = require('../common/PalettedStorage')
44

55
class SubChunk118 extends SubChunk13 {
6+
loadRuntimePalette (storageLayer, stream, paletteSize) {
7+
this.palette[storageLayer] = []
8+
9+
for (let i = 0; i < paletteSize; i++) {
10+
const runtimeId = stream.readZigZagVarInt()
11+
const block = this.registry.blocksByRuntimeId[runtimeId]
12+
this.palette[storageLayer][i] = { stateId: block.stateId, ...block, count: 0 }
13+
}
14+
}
15+
616
loadPalettedBlocks (storageLayer, stream, bitsPerBlock, format) {
717
if ((format === StorageType.Runtime) && (bitsPerBlock === 0)) {
818
this.palette[storageLayer] = []

0 commit comments

Comments
 (0)