Minecraft wiki entry for execute, associated text: Sets the execution dimension and position
It respects dimension scaling for relative and local coordinates: the execution position (only the X/Z part) is divided by 8 when changing from the Overworld to the Nether, and is multiplied by 8 when vice versa. Applies to custom dimensions as well.
Syntax
in <dimension> -> execute
Arguments
<dimension>: dimension
Name of the new execution dimension
Must be the resource location of a dimension. The standard dimensions in the minecraft namespace are "overworld", "the_nether", and "the_end".
Result
Execution dimension is updated
Unparseable if the argument is not specified correctly
Example
Looking for an end city (from the overworld): execute in the_end run locate EndCity
If a player at position (16,64,16) in Overworld runs command execute in minecraft:the_nether positioned as @s run tp ~ ~ ~, the player is teleported to (16,64,16) in the Nether.
If a player at position (16,64,16) in Overworld runs command execute in minecraft:the_nether run tp ~ ~ ~, the player is teleported to (2,64,2) in the Nether.
If a player at position (80,64,80) in Overworld runs command execute in minecraft:the_nether run tp ~ ~ ~5, the player is teleported to (10,64,15) in the Nether.