mojira.dev
MC-122894

Using teleport command without targets value in functions does not use original position

The bug

When using the /teleport command in functions you would expect that you can leave out the @s selector as "targets" value and there was no difference in functionality. But this is not true.
When using @s the command is executed based on the position where the entity, the function was run for, was when the execution of the function started (expected), however when leaving it out the current position is used.

Note: It appears this bug only affects functions. Using /execute in chat or in a command block does not appear to cause this bug.

How to reproduce

  1. Download the attached datapack

[media]
  1. and place it in the datapacks folder of your world

  2. Open the world

  3. Throw an item on the ground, move away and use the following command

    /execute as @e[type=item] at @s run function custom:teleport_selector

    → ✔ The item is teleported up at its original position, as expected

  4. Throw an item on the ground, move away and use the following command

    /execute as @e[type=item] at @s run function custom:teleport_no_selector

    → ❌ The item is teleported up at your position

Attachments

Comments 1

Fixed since 18w01a.

Marcono1234

Nathan Adams

Confirmed

/teleport, function, selector

Minecraft 17w48a, Minecraft 17w50a

Minecraft 18w01a

Retrieved