From f1c1f9a7d4cf977ce46975503f8f92db7836e8c9 Mon Sep 17 00:00:00 2001 From: FreezeEngine Date: Sat, 4 Jan 2025 21:26:44 +0300 Subject: [PATCH] Support for hashed block network ID's (#237) * loadRuntimePalette for 1.18-latest * using block.stateId --- src/bedrock/1.18/SubChunk.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/bedrock/1.18/SubChunk.js b/src/bedrock/1.18/SubChunk.js index 0f2af405..35cd8530 100644 --- a/src/bedrock/1.18/SubChunk.js +++ b/src/bedrock/1.18/SubChunk.js @@ -3,6 +3,16 @@ const { StorageType } = require('../common/constants') const PalettedStorage = require('../common/PalettedStorage') class SubChunk118 extends SubChunk13 { + loadRuntimePalette (storageLayer, stream, paletteSize) { + this.palette[storageLayer] = [] + + for (let i = 0; i < paletteSize; i++) { + const runtimeId = stream.readZigZagVarInt() + const block = this.registry.blocksByRuntimeId[runtimeId] + this.palette[storageLayer][i] = { stateId: block.stateId, ...block, count: 0 } + } + } + loadPalettedBlocks (storageLayer, stream, bitsPerBlock, format) { if ((format === StorageType.Runtime) && (bitsPerBlock === 0)) { this.palette[storageLayer] = []