Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-189885

New byte previousGamemode is read incorrectly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: 1.16 Pre-release 6, 1.16 Pre-release 7, 1.16 Pre-release 8, 1.16 Release Candidate 1, 1.16
    • Fix Version/s: 20w48a
    • Labels:
    • Confirmation Status:
      Confirmed
    • Category:
      Networking
    • Mojang Priority:
      Trivial

      Description

      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

        Attachments

          Activity

            People

            Assignee:
            boq [Mojang] Bartosz Bok
            Reporter:
            LordExecuter FivePB (Xer)
            Votes:
            13 Vote for this issue
            Watchers:
            12 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              CHK: