PrismarineJS / minecraft-data

Language independent module providing minecraft data for minecraft clients, servers and libraries.
https://prismarinejs.github.io/minecraft-data
636 stars 217 forks source link

Wrong type for packet_start_game's `player_permissions` field on bedrock #724

Open jsclary opened 1 year ago

jsclary commented 1 year ago

Is it expected that the seed and biome information will be wrong in packet_start_game when connecting to a realm or is there a parsing error? If it is expected, is the correct information available somewhere? The position information that precedes it seems correct aside from the off-by-one Y value which I assume is just the difference between head and foot or player and camera location. The dimension that comes after is correct but the permission level seems wrong as well. Other than world name and the engine version which look correct, I can't verify much else in the packet.

I'm attempting to look at the parsing to figure it out myself but I'm seeing conflicting information about the packet structure and a lack of specification for the encoding of some of the types in the packet.

extremeheat commented 1 year ago

This is resolved, right?

jsclary commented 1 year ago

Ah, no. I'm not sure how it got closed. Misclick, I guess, since I left the window open.

extremeheat commented 1 year ago

All the points you mention seem to be correctly handled to me, and I've checked against Gophertunnel, PocketMine and CloudburstMC to verify. This maybe an issue on your side.

There cannot be a parsing error in the middle of serialization, as all further data would be corrupted. The only possible thing wrong would be incorrect integer sign/endian interpretation, but that doesn't impact serialization.

jsclary commented 1 year ago

The endian thing was my first thought. I tried the most common endian conversion for the seed and that's not correct either but there are a few other possibilities. I don't see how that would be the issue for permission_level, though. That says I'm an operator when I'm a member. Biome, I suppose that could be the spawn biome but that should be jungle not forest and where I'm actually at is an ocean monument. I thought it might be a case of vestigial data where they changed the way things were done but had to leave the fields in the protocol for compatibility reasons.

jsclary commented 1 year ago

I tried another realm. This one gives the correct seed. The biome says plains when current location is a cherry grove but spawn is plains (just on the edge of the grove) so that's probably ok. It does have the wrong permission level, in the opposite direction. It says visitor when I'm operator.

extremeheat commented 1 year ago

Ah, looks like you're right on the permission field. It incorrectly changed on 1.19.10 in https://github.com/PrismarineJS/minecraft-data/pull/588 and affects all later versions. This is why we typically backpropagate updates to fields in minecraft-data. The type should be corrected to varint32 on all versions for start_game.

extremeheat commented 1 year ago

Feel free to do a PR to fix it here, the mapper should be specified in start_game as a varint32. I've transferred the issue to minecraft-data.