Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-122893

"/execute as/at" does not change the dimension of execution

XMLWordPrintable

    • Confirmed

      General usage

      In 1.12, running the following command in the Overworld will cause all "anchor" entities to set a block at their location, but restricted to their dimension. If there was an anchor in the End, the stone would appear correctly at their location:

      execute @e[tag=anchor] ~ ~ ~ setblock ~ ~ ~ minecraft:stone

      However, in 1.13 the following command will place the block only in the Overworld (provided the command is run in the Overworld). If an anchor exists in the End, they will place the block at their coordinates but only in the Overworld:

      execute as @e[tag=end] at @s run setblock ~ ~ ~ minecraft:stone

      If the command were instead run in the End, the anchor in the End would have the block placed correctly at their location. But if there were also an anchor in the Overworld, another block would appear in the End with the coordinates of the anchor in the Overworld.

      How to reproduce
      1. Use the following command in the overworld
        /summon armor_stand 10 10 10 {NoGravity:1b,Tags:["anchor"]}
        
      2. Get to the nether and use the following command
        /execute as @e[tag=anchor] run setblock ~ ~ ~ stone_slab
        
      3. Teleport to the position in the nether
        /teleport 10 10 10
        

      World-binding params

      There are a handful of "world-binding parameters" that lock the dimension of execution to that of the command sender, being: x/y/z/dx/dy/dz/distance. If none of these parameters are present, the selector will obtain targets from any dimension. If any of these parameters are present, the selector will only obtain targets from the command sender's dimension.

      In 1.12, the following would cause the "anchor" entity to state the name of a player around them, regardless of which dimension the /execute command originated from. For example, if the command were run via command block in the Overworld while the anchor was in the End, it would still work:

      execute @e[tag=anchor] ~ ~ ~ say Players around me: @a[r=5]

      However, in 1.13 the dimension will always be locked to the original dimension. If the command block were in the Overworld and the anchor were in the End, the following command fails due to the dimension remaining as the Overworld:

      execute as @e[tag=anchor] at @s run say Players around me: @a[distance=..5]

      Likewise, if the command block originated in the End, the above command works so long as the anchor is also in the End (and fails if the anchor is in the Overworld).

            dinnerbone [Mojang] Nathan Adams
            skylinerw [Mod] Skylinerw
            Votes:
            24 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: