Mojira Archive
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 MC-122894 datapack.zip 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

Fixed

Marcono1234

[Mojang] Nathan Adams

2017-12-05, 10:36 PM

2018-12-19, 02:17 AM

2018-12-19, 02:17 AM

3

3

Confirmed

/teleport, function, selector

Minecraft 17w48a, Minecraft 17w50a

Minecraft 18w01a