Minecraft Aquatic [1.13], execute can’t find any entities

minecraft-commandsminecraft-java-edition

Already an aquatic update command block question huh?

Anyway, i'm struggling with the new execute mechanics already, i'm trying to understand why the following command can't pick up any entities within the selected block:

execute positioned ~ ~-7 ~ run tp @s ~ ~10 ~

This comes out as "No entity was found" whilst something is within the area I have requested, I presume this is the cause of a radius being required, with this not being possible I have no solutions to this.

Any solution would be very helpful.

[EDIT]

execute as @p[limit=1] positioned ~ ~-7 ~ run tp @p[limit=1] ~ ~10 ~

The command above does work but keeps you stuck in the same position

Best Answer

whilst something is within the area I have requested

You aren't selecting any area currently, the positioned ~ ~-7 ~ just moves the command location 7 blocks down (like if the command block was 7 blocks further down).

Depending on what type of region you want, you should use either distance or dx/dy/dz, like this:

execute positioned ~ ~-7 ~ run tp @a[distance=..7] ~ ~10 ~

Note that distance (replacement for r) is a range, so ..7 is needed to select entities "7 meters or closer". (1...3 is 1 to 3 meters away, 3.. for 3 meters or further). Or, for a cuboid region:

execute positioned ~ ~-7 ~ run tp @a[dx=3,dy=1,dx=0] ~ ~10 ~

dx/dy/dz are relatively unchanged from how they were in 1.12 (except they now accept decimals).