Classify blocks by defaultState for runtime-state editions (Bedrock) - #388
Pix3lPirat3 wants to merge 1 commit into
Conversation
Movements builds its fence/carpet/emptyBlock sets from Block.fromStateId(block.minStateId). Bedrock uses runtime block-state palettes and has no static minStateId (it exposes defaultState), so on Bedrock fromStateId returned empty shapes and those sets were never populated (fences=0, carpets=0). Fall back to defaultState when minStateId is absent, restoring correct classification on Bedrock (fences=58, carpets=19) with no change on Java (minStateId always present). Verified live on BDS 1.26.45.
rom1504
left a comment
There was a problem hiding this comment.
Astra agent review — AI-generated, not manually written by the maintainer.
No blocking issue found in the fallback itself. I exercised the real Movements/prismarine-block path: the Java classification sets stay unchanged on 1.8.8, 1.20.4 and 1.21.1, and a Bedrock registry with minStateId omitted from its block list classifies the same sets as explicit defaultState lookup (58 fences, 19 carpets and 222 empty blocks on 1.26.45). Lint passes.
One scope clarification: the published Bedrock registry I tested already supplies minStateId, so that run alone does not exercise this fallback; the omitted-field check does. This review covers the local classification change, not the wider adapter or live navigation integration.
Skills used: prismarine-protocol-data-review checked the actual registry shape and state lookup; prismarine-architecture-review checked the existing model boundary; prismarine-review checked the diff and existing discussion.
Movementsbuilds itsfences/carpets/emptyBlockssets from the collision-shape height ofBlock.fromStateId(block.minStateId, 0).That assumes a static
minStateId, which Java has but Bedrock does not: Bedrock uses runtime block-state palettes and exposesdefaultStateinstead (minStateIdisundefined). On BedrockfromStateId(undefined)yields empty shapes, so none of those sets are ever populated —fencesandcarpetscome out empty, and fences are then treated as full/physical (walkable) and carpets as unsafe.Fix: fall back to
defaultStatewhenminStateIdis absent.minStateIdis always present, so??is a no-op — behaviour unchanged (verified: 1.21.1 stillfences=37,carpets=18,emptyBlocks=236).fences=58,carpets=19onbedrock_1.26.45), anddefaultStateresolves the correct shapes (e.g. oak_fence → 1.5-tall).Verified live on a Bedrock Dedicated Server (1.26.45) via the in-mineflayer Bedrock adapter (PrismarineJS/mineflayer#4145): pathfinder navigates, routes around walls, auto-jumps steps and digs through, and this fixes the fence/carpet classification. Java lint passes; no change to Java behaviour.