Skip to content

Commit

Permalink
Support for hashed block network ID's (#237)
Browse files Browse the repository at this point in the history
* loadRuntimePalette for 1.18-latest

* using block.stateId
  • Loading branch information
FreezeEngine authored Jan 4, 2025
1 parent eed7ca5 commit f1c1f9a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/bedrock/1.18/SubChunk.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] = []
Expand Down

0 comments on commit f1c1f9a

Please sign in to comment.