Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-122894

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

XMLWordPrintable

    • Confirmed

      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

            dinnerbone [Mojang] Nathan Adams
            marcono1234 Marcono1234
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: