mojira.dev
MC-102348

Order of chunk unloading, executing commands and removing unloaded entities causes problems

The following is based on a decompiled version of Minecraft 1.9 using MCP 9.24 beta.

The bug

When a chunk gets unloaded the entity in the chunk are added to the list net.minecraft.world.World.unloadedEntityList. When all entities are updated this list is cleared and the entities are removed from the list of loaded entities.
The problem is that commands are executed after a chunk is unloaded, but before the entities are unloaded:

Call order (MCP 9.24 beta)

1. Removing unloaded chunks ("Minecraft Server" line 767 -> "World Server" line 200)
2. Commands ("Minecraft Server" line 767 -> "World Server" line 216)
3. Updating entities ("Minecraft Server" line 778)

This causes bugs like MC-96131 where a chunk is unloaded, a command (or possibly something else as well) loads the chunk, the entities are not removed and their data becomes reset.

Related issues

Comments

migrated

Version 1.12.2 also affected. Seems a bit more sporadic, though. Tags seem to be retained (I'm assuming since it's stored differently), but scoreboard values are lost.

Adrian Östergård

Are there still issues related to this in 1.16.3 or later? If so, please provide a description of said issues.

marcono1234

(Unassigned)

Confirmed

(Unassigned)

chunk, command, entities, unload

Minecraft 1.9.2, Minecraft 1.11, Minecraft 1.12.2, Minecraft 17w48a

Retrieved