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

    • Confirmed
    • Data Packs, Dedicated Server, Networking

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

      The bug

      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 datapack MC-116887.zip and place it in the datapacks folder of a world
      2. Open the world an pause it
      3. Look at the log
        "Triggered" is still printed despite the game being paused

      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.

            Unassigned Unassigned
            marcono1234 Marcono1234
            Votes:
            7 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              CHK: