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

Integrated server continues to handle packets when paused allowing enter_block advancement trigger to run commands

    XMLWordPrintable

    Details

    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      Based on reddit post "[::] It knows when you are trying to pause the game, and it will find you..."

      The bug

      The the integrated server (when playing singleplayer) continues to handle packets when the game is paused. This allows the enter_block advancement trigger to continue running commands if a reward command teleports the player.

      Note: The client continues to handle packets while paused as well, which might be intended for multiplayer. It could however cause problems when it receives a GUI packet while the pause menu is open.

      How to reproduce

      1. Download the attached advancement enter_block_advancement.json and place it in the following directory of your world folder
        data\advancements\custom
        
      2. Download the attached function enter_block_function.mcfunction and place it in the following directory of your world folder
        data\functions\custom
        
      3. Open the world an pause it
      4. Look at the log
        → You will see that "Triggered" is still printed

      Code analysis

      Based on 1.11.2 decompiled using MCP 9.35 rc1 and 17w17a decompiled using CFR

      Teleporting a player sends a SPacketPlayerPosLook packet to the client. As a response it sends a CPacketConfirmTeleport and a CPacketPlayer.PositionRotation packet back. The latter one then causes the method net.minecraft.network.NetHandlerPlayServer.processPlayer(CPacketPlayer) to move the player and do block collisions, which then triggers the enter_block trigger.

      The server continues to handle packets because the method net.minecraft.server.integrated.IntegratedServer.tick() continues to run the tasks in the net.minecraft.server.MinecraftServer.futureTaskQueue which contains the packets as well.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              marcono1234 [Mod] Marcono1234
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                CHK: