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

Target selectors do not work reliably in minecraft:load functions when world is loading

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Awaiting Response
    • None
    • 20w49a
    • None
    • MC 20w49a/vanilla/snapshot
      Windows 10 Home
      AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx 2.10 GHz
      Java 1.8.0_51 64bit
    • Unconfirmed
    • (Unassigned)

      Target selectors do not work reliably in functions tagged minecraft:load when the world is loading - but not simply when datapacks are reloaded.

      Steps to reproduce:

      Create a datapack with four files (attached):

      • data/test/functions/test/onload.mcfunction
        execute unless entity @e[tag=tester] run function test:test/reboot
        
      • data/test/functions/test/reboot.mcfunction
        execute as @e[tag=tester] run say rebooting
        kill @e[tag=tester]
        summon armor_stand ~ ~ ~ {Marker: 1b, NoGravity: 1b, Silent: 1b, Invisible: 1b, Tags:["tester"]}
        execute as @e[tag=tester] run say rebooted
        
      • data/test/functions/test/rollcall.mcfunction
        execute as @e[tag=tester] run say hi
        
      • data/minecraft/tags/functions/load.json
        {"values": ["test:test/onload"]}
        

      Create a world. Add this datapack manually.

      Enter the world and run the following. Observe that one armor stand responds with "rebooting" then with "hi" - as expected.

      /reload
      /function test:test/rollcall
      

      Run the following. Observe that one armor stand responds with "hi", indicating that reboot was not called - as expected.

      /function test:test/onload
      /function test:test/rollcall
      

      Save, exit, and reload the world.

      Run the following. Observe that two armor stands respond with "hi". This means that onload then reboot were called - not as expected.  The kill command did not work and the summon command did, since it has no target selector to fail. The target selectors in onload and reboot both fail to find entities.  Observe also that no armor stand responds with "rebooting" and one armor stand responds with "rebooted" in the game output - not as expected, since there are one and two entities at those times, respectively.

      /function test:test/rollcall
      

      Run the following. Observe that still two armor stands respond with "hi", indicating that reboot was not called - as expected. This indicates that the issue is unique to world load, and not just any datapack reloading.

      /reload
      /function test:test/rollcall
      

      Run the following. Observe that two armor stands respond with "rebooting", then one with "rebooted", then one with "hi", indicating that reboot does work after the world is loaded - as expected.

      /function test:test/reboot
      /function test:test/rollcall
      

      What was expected
      Target selectors work on world load so that, in the example above, reboot is not run again when the world is reloaded.

            Unassigned Unassigned
            alphappy alphappy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: