-
Bug
-
Resolution: Fixed
-
Minecraft 1.10.2, Minecraft 16w40a, Minecraft 16w43a, Minecraft 16w44a, Minecraft 1.11 Pre-Release 1, Minecraft 1.11, Minecraft 1.11.2, Minecraft 1.12, Minecraft 1.12.1 Pre-Release 1, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 17w50a, Minecraft 18w20a, Minecraft 18w20b, Minecraft 1.13-pre1, Minecraft 1.13-pre2, Minecraft 1.13-pre3, Minecraft 1.13-pre4, Minecraft 1.13-pre6, Minecraft 1.13-pre7, Minecraft 1.13-pre8, Minecraft 1.13, Minecraft 1.13.2, Minecraft 18w48a, Minecraft 18w48b, Minecraft 18w49a, Minecraft 18w50a, Minecraft 19w02a, Minecraft 19w03c, Minecraft 19w04a, Minecraft 19w04b, Minecraft 19w05a, Minecraft 19w06a, Minecraft 19w07a, Minecraft 19w08b, Minecraft 19w11b, Minecraft 19w12b, Minecraft 1.14.2, Minecraft 1.14.3 Pre-Release 1, Minecraft 1.14.3 Pre-Release 2, Minecraft 1.14.3 Pre-Release 3, Minecraft 1.14.3 Pre-Release 4, Minecraft 1.14.3, Minecraft 1.14.4 Pre-Release 1, Minecraft 1.14.4 Pre-Release 2, Minecraft 1.14.4 Pre-Release 3, Minecraft 1.14.4 Pre-Release 4, 1.14.4, 19w36a, 19w37a, 19w40a, 19w41a, 1.15 Pre-release 1, 1.15.1, 1.15.2 Pre-Release 1
-
Confirmed
-
Chunk loading, Entities
-
Important
The bug
In many cases when entities are moved into another chunk they are not added to the new chunks entity lists rightaway.
Instead they get added when the entity receives the next update tick. Until that happens the entity will not be found by some searches that use the chunk-wise lists.
In some cases (like in lazy chunks) it can even happen that the entity is not ticked and doesn't get added to the new list at all. Upon unloading the world the entity will not get saved in the correct chunk and be deleted upon the next reload.
Two cases where this bug can happen are teleport commands and pistons. It's likely that there are more cases though.
How to reproduce
- Create a superflat world.
/setworldspawn 0 0 0
/tp 1000 100 0
- Reload the world to make sure only the right chunks are loaded.
/summon minecraft:armor_stand 0 100 0 {NoGravity:1,Tags:["MC-108469"]}
/tp @e[tag=MC-108469,x=0,y=100,z=0,distance=..10] 200 100 0
Notice that the target position is still a loaded chunk, just not one in which entities get ticked.
- If you now unload and reload the world the armour stand will be gone only leaving the following messages in the launcher:
[INFO] 01:58:46.893 Preparing spawn area: 0% [WARN] 01:58:46.919 Wrong location! (12, 0) should be (0, 0), avm['Armor Stand'/22, l='19w46b', x=200.50, y=100.00, z=0.50] [INFO] 01:58:46.960 Changing view distance to 31, from 10
Alternatively to reloading the world, the error can be shown using these commands. They are not able to find the entity.
/say @e[tag=MC-108469]
/say @e[tag=MC-108469,x=200,y=100,z=0,distance=..100]
In contrast this one does find the entity:
/say @e[tag=MC-108469,x=200,y=100,z=0,distance=..1000]
Given the position of the armorstand all of the above commands should be able to find it, however, since it is not constantly updated across different entity lists, only the third one will find it (as off 1.15pre1).
Also note that the behaviour of these commands is highly dependant on performance decisions of entity selectors and might not behave the same under all conditions.
This issue affects survival (pistons) as well as creative/map making (teleport commands).
Another way this issue shows is when trying to teleport an entity twice in the same tick through several chunks, using selectors that make use of the chunk entity lists. The second selector will then not be able to find the entity.
Code analysis
Code analysis and suggested fix by Xcom6000 can be found here and there. Additional minor optimization here.
- is duplicated by
-
MC-129685 /tp command doesn't handle entity tp properly
- Resolved
-
MC-143173 If an entity is teleported to an unloaded chunk, upon leaving then reloading the game the entity no longer exists
- Resolved
-
MC-153381 /teleport does not update chunk positions of entities
- Resolved
- relates to
-
MC-44514 Teleporting ridden entity in unloaded chunks does not cause chunks to load for riding player
- Resolved
-
MC-89667 Position based selector arguments fail finding entity if it has been moved to a different chunk in the same tick
- Resolved
-
MC-92916 Player is removed from the EntityTracker when teleporting to unloaded chunks or changing dimensions, resulting in client side desync
- Resolved
-
MCPE-21416 Mobs and Entities can despawn randomly
- Resolved
-
MC-153904 Villagers sometimes disappear without any trace
- Reopened
-
MC-22147 Entity duplication bug
- Resolved
-
MC-125824 Unexpected behavior with same-tick entity teleportation and summoning over multiple chunks
- Resolved