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

New byte previousGamemode is read incorrectly

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Fixed
    • 1.16 Pre-release 6, 1.16 Pre-release 7, 1.16 Pre-release 8, 1.16 Release Candidate 1, 1.16
    • 20w48a
    • Confirmed
    • Networking
    • Low

    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

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

            Dates

              Created:
              Updated:
              Resolved:
              CHK: