mojira.dev
MC-133579

Cross-dimensional @s selector succeeds despite world-binding parameters

The bug

World-binding selector arguments x y z dx dy dz distance will restrict selector results to entities in the dimension the command context is executing from. However @s is not restricted, and it will be found regardless of the presence of world-binding arguments if the sender dimension differs from the context dimension.

How to reproduce

  1. Enter the overworld.

  2. /execute in the_nether unless entity @a[x=0]
    →  ✔  Test passed

  3. /execute in the_nether unless entity @s[x=0]
    →  ❌  Test failed, count: 1

Linked issues

Comments 14

Confirmed in 1.16 Pre-release 5.

Confirmed in 1.16 Pre-release 5.

1.16.1

This also applies to @a

So if you use some kind of coordinate restriction the dimension context is applied but if you dont then it will select players from any dimension.

tellraw @a "hello" tells everyone in all dimensions as you would expect

but so does this even though you would expect it to just apply to the named dimension:

execute in pw:spleef run tellraw @a "hello"

whereas this next one correctly restricts the dimension:
execute in pw:spleef run tellraw @a[x=0,y=50,z=0,distance=..500] "hello" - just tells players in the spleef dimension

this feels incorrect and means you have to test nbt data unnecessarily

Also applies to @e.

so execute in aworld run kill @e[type=item] takes no notice of being in 'aworld'

You need to include worldbinding parameters to restrict most selectors to the target dimension. That is intended. The problem is that worldbinding parameters do not restrict @s

4 more comments

Confirmed in 1.16.3.

Confirmed in 1.16.3.

Can confirm in 20w49a.

Can confirm in 21w03a.

Can confirm in 21w06a.

tryashtar

(Unassigned)

Confirmed

Platform

Normal

Commands

Minecraft 1.13-pre8, Minecraft 1.13, Minecraft 18w30a, Minecraft 18w32a, Minecraft 1.13.1, ..., 21w03a, 21w06a, 1.18.1, 1.19.2, 1.20.2

Retrieved