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

If a non-player entity is teleported to unloaded chunks using a command inside of a function, the commands following the teleport command are not run unless the @s selector is used

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • Minecraft 1.14.4 Pre-Release 5, Minecraft 1.14.4 Pre-Release 6
    • None
    • OS: Windows 10 Professional
    • Unconfirmed
    • (Unassigned)

      If a non-player entity is teleported to unloaded chunks using a command inside of a function, the commands that are below the teleport command are not run unless the @s selector is used. This is a bug because all commands inside of a function are run within the same tick, meaning that the commands following the teleport command should be able to run before the entity unloads.

       

      How to reproduce:
      1. Create a new world with cheats enabled
      2. Create a datapack called "test" in that world with a namespace called "test" containing one .mcfunction file called "test.mcfunction"
      3. Put these two commands, in this order, in separate lines of the function file: teleport @s -6900 70 6900 and execute at @s run forceload add ~ ~
       4. Summon an armor stand and give it the tag "test" (using this command: /tag @e[type=armour_stand] add test)
      5. Run this command in the chat: /execute as @e[tag=test] at @s run function test:test

      The armor stand should then be teleported to -6900 70 6900 and should be loaded thanks to the forceload command (you can check if the armour stand is loaded using this command: /execute if entity @e[tag=test].

      Now, the same steps must be repeated with a couple of changes

      1. Enter the same world you previously created (unless you are inside of the world already)
      2. Open test.mcfunction with an editor. Delete everything that is inside of the function file. Then, Put these two commands, in this order, in separate lines of test.mcfunction: teleport @e[tag=test] -6900 70 6900 and execute at @e[tag=test] run forceload add ~ ~
      3. Kill all armor stands in the world and remove all forceloaded chunks. Summon a new armor stand and give it the tag "test"
      4. Run this command in the chat: /execute as @e[tag=test] at @s run function test:test

      The armor stand should then still be teleported to -6900 70 6900 and should be loaded by the forceload command. However, the forceload command does not work in this case and, therefore, the armour stand remains unloaded. This should not happen as the @s selector is selecting the exact same entity that the @e[tag=test] selector was targeting, meaning that the commands should do the exact same thing.

            Unassigned Unassigned
            jirauser200375 user-f5d8c (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: