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

Last player game mode not saved after player dies or the game is reloaded

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.19.3, 23w07a, 1.19.4 Pre-release 4, 1.19.4, 23w14a, 1.20.1, 1.20.6, 1.21
    • Community Consensus
    • Commands
    • Normal
    • Platform

      The bug

      When joining a world or switching dimensions while in spectator mode, the game will forget the last game mode you were in and will put you into spectator mode (The game mode you are already in) when using F3 + N or F3 + F4.

      Expected result

      You should be set to survival/creative/adventure (whatever your last game mode was) whenever you use F3 + N or F3 + F4.

      To reproduce

      Steps (1)

      1. Join a world.
      2. Set your game mode to spectator mode.
      3. Use the /execute command to teleport into the nether.
      4. Press F3 + N to attempt to switch back to your previous game mode.

      Steps (2)

      1. Join a world.
      2. Set your game mode to spectator mode.
      3. Leave and rejoin the world.
      4. Press F3 + N to attempt to switch back to your previous game mode.

      Steps (3)

      1. Join a world.
      2. /gamemode creative
      3. /gamemode spectator
      4. Press F3 + F4
      5. The game switches back to creative mode
      6. /kill or rejoin the world/server
      7. Press F3 + F4
      8. The game switches back to spectator mode

      Code analysis

      Code analysis by senseiwells can be found in MC-260836 (Yarn mappings).

      ServerPlayerInteractionManager#changeGameMode (1.19.3):

      ServerPlayerInteractionManager#changeGameMode (prior to 1.19.3):

      The previous game mode being set in ServerPlayerInteractionManager#setGameMode is no longer being set to the existing gamemode but instead the previous one, meaning that this never changes - it is always null, unless the player had set their previous gamemode in a version prior to 1.19.3.

            Unassigned Unassigned
            choochoo2112 Choo_Imperium
            Votes:
            14 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              CHK: