minecraft-data icon indicating copy to clipboard operation
minecraft-data copied to clipboard

Fix(protocol): use ZigZag64 instead of VarInt64 in packet_player_location

Open Snowbelldog opened this issue 3 months ago • 3 comments

fix(protocol): use ZigZag64 instead of VarInt64 for entity_unique_id at packet_player_location

The entity_unique_id field in packet_player_location was incorrectly deserialized as VarInt64. It is now handled as ZigZag64, fixing mismatched IDs when comparing with player_list.

Snowbelldog avatar Sep 21 '25 01:09 Snowbelldog

Thanks, does this apply to any other versions?

extremeheat avatar Sep 21 '25 07:09 extremeheat

I checked the CloudburstMC Java implementation used in GeyserMC. There is only a deserializer for this starting from protocl version v800 (link). The implementation at first looks like a regular VarInt, but on closer inspection it’s actually a ZigZag64. Therefore, in previous versions this was also incorrect.

Snowbelldog avatar Sep 21 '25 14:09 Snowbelldog

I also noticed that in packet_update_trade there seems to be a similar issue in all versions, including the villager_unique_id field. However, I think it would be out of scope here. (link)

Snowbelldog avatar Sep 21 '25 14:09 Snowbelldog