Minecraft 17w17b, Minecraft 1.12 Pre-Release 5, 20w07a, 22w15a
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 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
- Download the attached datapack MC-116887.zip and place it in the datapacks folder of a world
- Open the world an pause it
- Look at the log
"Triggered" is still printed despite the game being paused
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.