feat(mineflayer): forward map_chunk + update_light packets to renderer worker (PR #15 - Renderer)#549
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
tbh I think we could keep everything off the worldView here (IMO worldView has to be reworked) and use maybe backend methods instead? IMO we should have leave all renderer communication with two-way methods eg renderer backend methods + reverse callbacks |
Agreed. But the full backendMethods + reverse-callbacks/playerState pattern is overkill here: the data flow is strictly one-way fire-and-forget (client → renderer worker, no response, no shared state). We only need the forward half. Proposal:
Bonus: workerProxy auto-detects Transferables, so Uint8Array.buffer goes zero-copy to the renderer worker (currently worldView does structured clone, ~10–30 KB per chunk). |
|
Sounds nice |
What this does
Wires the client into the new WASM parser on the renderer side. The entire client-side change is one new listener file plus one line of plugin registration — all parsing/conversion/caching complexity lives in the renderer.
Files
src/mineflayer/plugins/index.ts(+2): import +mapChunkListener()call.src/mineflayer/plugins/mapChunkListener.ts(+273, new): three version-gated branches.Version routing by
bot._client.version/ protocolappViewer.worldView>= 757raw.map_chunk,raw.update_lightsetRawMapChunk,setRawUpdateLight756map_chunk(parsed),raw.update_lightsetParsedMapChunkV17,setUpdateLightV17735–754map_chunk(parsed),raw.update_lightsetParsedMapChunkV16,setUpdateLightV16For protocols < 735 we don't attach — those versions are still served by the legacy
convertChunkToWasmpath through the standardprismarine-chunkflow.Tests / smoke