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

Player becoming visible for other players in LAN world / on server is not notified about own data parameter change

XMLWordPrintable

    • Confirmed
    • Spectator
    • (Unassigned)

      The bug

      Players becoming visible for other players are not notified about their own data parameter change. This causes them to remain invisible after switching to something different than Spectator mode or to not become invisible when switching to Spectator mode which results in a opaque head.

      Unlike MC-104816 this is not permanent and changes in the flags data parameter value (such as shifting, catching fire, glowing) will update the visibility correctly.

      How to reproduce (invisible non-Spectator)

      1. Enter a server or LAN world with at least one other player in a gamemode other than Spectator mode
      2. Switch to Spectator mode
        /gamemode spectator
        
      3. Switch back to for example Creative mode
        /gamemode creative
        

        → You will notice that you are still invisible

      How to reproduce (opaque Spectator head)

      1. Enter a server or LAN world with at least one other player in a gamemode other than Spectator mode
      2. Switch to a gamemode other than Spectator mode
        /gamemode creative
        
      3. Switch your and the gamemode of at least one other player to Spectator mode
        /gamemode spectator @a
        

        n - 1 (with n being the number of player switched from non-Spectator to Spectator) players will see their own head opaque

      Code analysis

      Based on 1.11.2 decompiled using MCP 9.35 rc1

      When the gamemode of a player changes the visibility for other players and the player himself is updated. This happens before the player is notified about data parameter changes like for example the flags one which stores if a player is invisible. The problem is that in this case the constructor net.minecraft.network.play.server.SPacketEntityMetadata.SPacketEntityMetadata(int, EntityDataManager, boolean) marks the data manager of the player as not dirty and therefor the player himself is not notified about the changed.

      The "opaque Spectator head" case is caused by the same problem but there it might be harder to see the reason, therefor the following shows what happens when you change the gamemode for multiple players. In this scenario there are two players, "Player A" and "Player B" which are both not in Spectator mode.

      1. Player A is switched to Spectator mode
      2. Other players are updated
        1. Player A becomes invisible for Player B
      3. Player B is switched to Spectator mode
      4. Other players are updated
        1. Player A becomes visible for Player B
          1. Data parameter values of Player A are sent and data manager is set to clear
      5. Entity tracker sends packets for players with dirty data manager
        → Player B receives a packet but Player A does not

            Unassigned Unassigned
            md_5 [Mod] md_5
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: