mojira.dev
MCPE-32094

Selectors erroneously find all entities in overlapping blocks

The bug

Selector arguments such as c, r, dx, dy, and dz work entirely on the block level – an entity that is physically outside the range will still be detected if it anywhere is inside a block that is partially inside the range.

How to reproduce

1. Teleport yourself to the center of some block: /tp @s 0 64 0
2. Summon an armor stand 1.5 blocks away from you: /summon armor_stand ~ ~ ~1.5
3. Run a selector from the armor stand: /execute @e[type=armor_stand,c=1] ~ ~ ~ say @a[r=1]
Expected result: empty output since the player is further than one block away.
Actual result: player is found.

The player can continue moving even further away from the armor stand – any position in the block teleported to will be found by the selector, even those that should not be. Even if the armor stand is in a position such that the r=1 "sphere" barely overlaps a block, entities will be found regardless of where they are in that block.

In practice, this makes precise position selectors difficult or impossible – despite the existence of decimal selector arguments, all searches are done on a per-block level. I used integers exclusively to demonstrate here, but this is easily reproducible with the decimal ones: /execute @e[type=armor_stand,c=1] ~ ~ ~ say @a[r=0.001] should almost never find players, but in reality it finds every player that shares a block with it.

Attachments

Comments 3

Attached an image which is at 16,3,16 (white wool) in a world and has positive X going towards the left and positive Z going towards the top.

I tested this by placing two armor stamds, summoned (for precise placement), with one barely inside a black wool and one barely outside (in the iron blocks). No matter where I was on the white wool (bottom right), testing for entities with a max radius of 15 only found one of the two.

Content Edit: This layout was made over 16 iterations, one r= higher each time, of a repeating command block and me walking around to fill ... replace ... safely.

I attached a screenshot that illustrates this behavior clearly – the selector should only find entities within the bounds of the circle, but it also finds entities outside the bounds if they are in a block space that the circle overlaps.

The yellow Steve represents the origin of the selector, and the green Steves represent entities the selector finds. Two of the green Steves should not be found.

Fixed in what's currently called the 1.5 beta

tryashtar

(Unassigned)

Unconfirmed

Windows

1.2.14.3, 1.2.13.54

1.5.0.14

Retrieved