Mojira Archive
MC-189885

New byte previousGamemode is read incorrectly

In 1.16 Prerelease 6 there was a field added to both the Login/Join Game packet and the Respawn Clientbound packets
These packets now contain the previous gamemode ID of the player.
Alsongside this; Gamemode ID -1, (Not defined gamemode) was added.

There is an issue with this however.

Both the current and past gamemodes are written to the netty network buffer by their integer ID.
That's -1 for Not defined.
They are written as *signed bytes*

The client then gets those and reads them as *unsigned bytes*
This does NOT create an issue were all gamemode IDs always positive (prior to this they were)
But since this snapshot there is a negative gamemode ID which can NEVER be read correctly by this

Sending the client -1 as ID will make it read 255 from the buffer.
Solution: Read both gamemode IDs as signed bytes, like they should be read

Fixed

LordExecuter

[Mojang] Bartosz Bok

2020-06-15, 10:01 PM

2021-08-18, 04:39 PM

2021-02-02, 03:12 PM

13

9

Confirmed

Low

Networking

networking, packet

1.16 Pre-release 6 - 1.161.16 Pre-release 6, 1.16 Pre-release 7, 1.16 Pre-release 8, 1.16 Release Candidate 1, 1.16

20w48a