Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

networkDecodeNoCache super call passes Stream instead of Buffer #182

Open
lowlines opened this issue May 23, 2022 · 10 comments
Open

networkDecodeNoCache super call passes Stream instead of Buffer #182

lowlines opened this issue May 23, 2022 · 10 comments

Comments

@lowlines
Copy link

The super call this function makes parses the Stream instead of Buffer, which throws an error since new Stream(stream) doesn't type check that it is a buffer and handle accordingly.

super.networkDecodeNoCache(stream, sectionCount)

@lowlines
Copy link
Author

It's also worth noting that this line should return as errors thrown inside this super call cannot be caught and the app will crash.

return super.networkDecodeNoCache(buffer, sectionCount)

@extremeheat
Copy link
Member

This isn't a condition that should generally be hit at all. Feel free to open a PR to fix.

@lowlines
Copy link
Author

Really? I'm seeing that condition hit 100% of the time with 1.18.30 level_chunk packet data. Also the presence of border blocks.

@extremeheat
Copy link
Member

Bedrock 1.18.30 chunks are not currently supported, 1.18.0 chunks are.

@lowlines
Copy link
Author

I implemented experimental support for newer chunks and fixed 2 errors I found. I'm not sure how to go about doing a PR though as I don't have write access. Should I create a fork and link to that?

@extremeheat
Copy link
Member

Yes you can open a PR. You need to fork, push changes to your branch and make a PR to merge your branch into PrismarineJs master

@extremeheat
Copy link
Member

Only change with bedrock 1.18.10 over .0 I believe was an extra byte in the stream header. Will address this in a PR tomorrow, hopefully Mojang doesn't ship 1.19 before then 😅.

@lowlines
Copy link
Author

lowlines commented Jun 4, 2022

So what I ended up doing was implement my own ChunkColumn and SubChunk classes because updating prismarine was creating a bit of a blocker for me. I mostly just added a condition for when the sub_chunk_count is -2 to just loadBiomes and ignore the rest of the data. It's still a few days before 1.19 ships!

@extremeheat
Copy link
Member

mode -2 (added in 1.18.30) appears to just add an extra field to the LevelChunk packet excluding the change with the RequestSubChunk now taking arrays. Could be more changes, needs more investigation. Will address tomorrow if it's just that, no other changes with 1.19 it seems like

@extremeheat
Copy link
Member

Turns out there were more changes with chunk request procedure. This needs to be handled in bedrock provider tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants