mojira.dev
MC-89667

Position based selector arguments fail finding entity if it has been moved to a different chunk in the same tick

The bug

Selector arguments which select entities based on their position fail finding them if they have been moved to a different chunk in the same tick. Moving the entity to the next chunk might not always cause this bug since the initial entity search area can be larger than the specified values.

The root cause is likely MC-108469 because at least in 1.12.2 selectors get the entities to check from the respective chunks and if the entity lists have not been updated the entities will not be found.

Note: This does not affect the @s selector.

Affected selector arguments

Last updated for 17w50a

  • distance

  • dx

  • dy

  • dz

How to reproduce

  1. Place an impulse command block with the following command

    /execute as @e[type=armor_stand] at @s run teleport @s ~33 ~ ~
  2. Place an always active chain command block with the following command behind it

    /execute as @e[type=armor_stand] at @s run say @e[distance=0]
  3. Place an armor stand

  4. Power the impulse command block
    → ❌ It fails finding itself

Related issues

Attachments

Comments

migrated
[media][media]
migrated

I highly doubt this has to do with my computer, but to be sure it would be nice if someone could confirm this.

migrated

Still an issue in 15w46a

migrated

It's because entities don't run commands in unloaded chunks; this has nothing to do with the chain command block's functionality.
It's that you're teleporting the entity in a unloaded chunk. Now, it might seem like it works when you're near the command blocks and run the commands, which is because you loaded the entity for a few seconds or less allowing the commands to be executed. You'll need to load the chunk first before teleporting the entity to that location in order for it to work even though you're far from the command blocks.

migrated

@Logical_Cyclops No that is not true. Both the chunk that the entity starts in and the chunk it get's teleportet to are loaded. As I stated in the Description even a distance of two chunks is to much.

migrated

By the way this also affects Players (wich is the actual use case for me) and I would think that Players should always be loaded.

migrated

Here is a video showing this bug: https://www.youtube.com/watch?v=ls03ofiNTSA

migrated

OH! I see now. I thought you meant teleporting the entity to a completely far away chunck. I'll have me and my friends vote on this bug.

migrated

Confirmed for 1.9-pre1

migrated

Confirmed for 1.9-pre4

migrated

This bug is so frustrating for me, yet it doesn't get attention.

migrated

Make sure to include the 1.9.1 pre release versions as the effected versions if it occurs on one of the 1.9.1 pre releases. And dude, there are many bug tickets that mojang has to go through. So have patience and in time, it will get looked at by a mojangsta.

marcono1234

I changed the description and removed large parts of it, I hope you are fine with this.

migrated

As per my comment on MC-124491, I think it's fine if this is WAI or WontFix (for efficiency reasons), but it would be good to get an 'official ruling'.

Asteraoth

Unless I have reproduced this bug wrong, then it seems to be fixed in 1.13-pre8.

Edit: Yup, I have reproduced this wrong affects both 1.12.2 and 1.13-pre8.

kumasasa

@unknown, could you repro this in 1.12.2?

Asteraoth

Confirmed for 1.13

Asteraoth

Confirmed in 18w30b

Asteraoth

Confirmed for 18w31a

Asteraoth

Confirmed for 18w32a

Asteraoth

Confirmed for 18w33a

Asteraoth

Confirmed for 1.13.1-pre1

j_p_smith

Confirmed in 1.15.2 and 1.16 Release Candidate 1.

pulpetti

Affects 1.16.1 and 20w27a

migrated

fixed in 20w45a; likely because MC-108469 was fixed

marcono1234

I cannot even reproduce this in 1.16.4. Can someone still reproduce this in 1.16.4 (or 20w45a)? If not we will resolve this report as "Cannot Reproduce" since the exact fix version is unknown.

Though interestingly I am seeing the following warning in 1.16.4 which I am not seeing in 20w45a (but the armor stand is still present when loading the chunk where it has been teleport to):

Entity bcn['Armor Stand'/5, l='ServerLevel[Test]', x=240.50, y=1.00, z=11.50] left loaded chunk area
Avoma

I am unable to reproduce this in 20w49a.

onnowhere

Attached a datapack. I can reliably reproduce this with the following steps, however I am not sure if this is a new related bug or the same bug.

  1. Summon one 'selected' stand and a few extra stands at your position with /function teleport_position_bug:summon

  2. Move yourself an arbitrary distance, or /tp ~32 ~ ~

  3. Run the following function to teleport the 'selected' stand to you, then teleport all stands to it, and print out whether it found any armor stands within 1 block of it /function teleport_position_bug:move

  4. If the output is 'NO OUTPUT' the selected stand found no other stands in 1 block. You will notice that the armor stands are indeed all teleported to the stand, thus the bug has been reproduced.

  5. If the output is 'ENTITY FOUND' the other stands were found. Repeat and/or change the distance you move.

This can be reproduced additionally if you do the following method:

  1. Summon a moving pig /summon pig ~ ~ ~ {Motion:[0.0d,5.0d,0.0d]} 

  2. Spam this command to see both 'NO OUTPUT' and 'ENTITY FOUND' at different intervals of the pig's flight /execute as @e[type=pig] at @s run function teleport_position_bug:move

This bug is circumvented if you do the following:

  1. Repeat the original steps, but in step 3 use /function teleport_position_bug:move_from_stand

  2. This will summon a stand at your position, then run the move function, then kill the original stand. Somehow when there is not a direct teleport to an existing entity, this bug is circumvented

onnowhere

attached a video demonstrating the datapack reproducing the issue

onnowhere

Correction on the previous comments: This bug looks like it has been fixed. In 1.16.4 this bug was present, however in 20w45a it was fixed. This is very likely due to the resolution of MC-108469. I cannot reproduce this bug anymore from 20w45a onwards using my provided datapack.

marcono1234

Thanks for letting us know, @unknown. I will resolve this report as "Cannot Reproduce" then since we don't know for sure if 20w45a really had the intention to fix this specific bug, or only fixed it by accident.

migrated

(Unassigned)

Confirmed

(Unassigned)

radius, selector, teleport

Minecraft 15w39c, Minecraft 15w40b, Minecraft 15w42a, Minecraft 15w46a, Minecraft 16w06a, ..., Minecraft 1.13.1-pre1, Minecraft 1.13.1, 1.15.2, 1.16 Release Candidate 1, 1.16

Retrieved