0

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

  • Are you executing this from a command block or from chat? @p[limit=1] doesn't differ in effect from @p. positioned doesn't change executor. @s always refers to the executor. How do you know that the second command works if it does nothing? What are you even trying to achieve? – Fabian Röling Jul 19 '18 at 14:26
  • 1, using it from a command block, 2, I realise this, and 3, it's for just teleportation from a single block, but pre 1.13 this was A LOT easier, The second command teleports you and makes it unable to move from the point your teleported to – XplosiveAsh Jul 19 '18 at 15:52
  • 1. @s doesn't work like that in a command block: It would target the command block, which of course isn't an entity. 3. "teleportation from a single block"? What do you mean? 4. Still: Why do you say that the command worked if it did nothing? What actually happen? 5. Still: What is your overall plan? – Fabian Röling Jul 19 '18 at 15:56
0

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).

-2

I'm not sure why but I haven't had a lot of luck using @s in a command block. I know you want to have the person triggering the block be the only one teleported but i think @p works better even if it seems like it would scoop up more accidental participants. I've gotten in the habit of doing @p[limit=1] in those situations.

  • When I edited it it worked but got me into an unfortunate stuck position. Probably just me needing to change the command, still thanks – XplosiveAsh Jul 19 '18 at 11:05
  • @p only ever selects one player. – Fabian Röling Jul 19 '18 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.