Detailed description of a problem
Problem with a mismatch between the blockStates and blocksByStateId keys, the same index from the blockStates key points to another block in the blocksByStateId key. This issue concerns all other prismarine repositories whose users use the bedrock block register version 1.21.50 or higher.
How to reproduce
import PrismarineChunk from "prismarine-chunk"; // example on prismarine-chunk
import registry from "prismarine-registry"
const version = "1.21.50"
const startgamePacket = {/* there startgame packet from target server */}
const levelchunkPacket = {/* there levelchunkpacket from target server */}
const subchunkPacket = {/* there requested for levelchunk subchunk packet with y = 0 and diamond_block on x = 0, z = 0 from target server*/}
const reg = registry(`bedrock_${version}`)
reg.handleStartGame(startgamePacket)
const pchunkConstructor = PrismarineChunk(reg)
const PChunk = new pchunkConstructor({x: levelchunkPacket.x, z: levelchunkPacket.z})
await PChunk.networkDecodeNoCache(levelchunkPacket.payload, Number(levelchunkPacket.sub_chunk_count))
await PChunk.networkDecodeSubChunkNoCache(Number(subchunkPacket.dy), subchunkPacket.payload)
PChunk.getBlock({x: 0, y: 0, z: 0}) // Outpus: name: 'end_bricks' Instead name: 'diamond_block'
Additional context
I found this problem inside prismarine-registry, this problem extends to bedrock versions 1.21.5x and higher.
Example of method loadRuntimeIds which uses problem keys
function loadRuntimeIds () {
data.blocksByRuntimeId = {}
for (let i = 0; i < data.blockStates.length; i++) {
// i = 11996, data.blockStates[i].name = 'air'
data.blocksByRuntimeId[i] = { stateId: i, ...data.blocksByStateId[i] } // data.blocksByStateId[i].name = "crimson_hanging_sign"
}
}
Detailed description of a problem
Problem with a mismatch between the blockStates and blocksByStateId keys, the same index from the blockStates key points to another block in the blocksByStateId key. This issue concerns all other prismarine repositories whose users use the bedrock block register version 1.21.50 or higher.
How to reproduce
Additional context
I found this problem inside prismarine-registry, this problem extends to bedrock versions 1.21.5x and higher.
Example of method loadRuntimeIds which uses problem keys