mojira.dev
MC-265472

Teleporting CMDs are not working correctly.

Hello

By using the tp cmd in an command block I was not teleported correctly.

So, I add the cmd tp @e[type=minecraft:player,distance=..2] ~ ~1 ~
The result is teleporting me 1 block negative Z not positive Y

Comments 5

Teleport commands do not teleport relative to the target, not since 1.13; commands have 4 variables: who (@s), facing (x/y rotation), position (x, y, z), and dimension, none of these are related to eachother. Using /execute you can change these variables. If run in command blocks, it runs as the command block (no @s) at the command block. Saying to teleport 1 block up means 1 block above the execution position, so 1 block above the command block.

So. I dont want teleporting the command block. I want teleporting the player to reletive coordintes.

The cmd tp @p[distance=..2] ~ ~1 ~ and execute if entity @p[distance=..2] run tp @p[distance=..2] ~ ~1 ~ are same.

I can not teleport players or entities from there position to relative coordinates.

Please give me proof that you can use a command block to move a player or an entity relative.

execute as <target> at @s run tp @s ~ ~1 ~

This is not a help desk.

Thank you vary much.

execute as @e[type=minecraft:player,distance=..2] at @s[type=minecraft:player,distance=..2] run tp @s ~ ~1 ~

is working.

user-94f8e

(Unassigned)

Unconfirmed

(Unassigned)

1.20.2 Release Candidate 2

Retrieved