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

Function tag ordering is inconsistent across reloads and does not respect datapack ordering

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 18w15a, Minecraft 18w16a, Minecraft 18w21b, Minecraft 1.13-pre3, Minecraft 1.13-pre4, Minecraft 1.13-pre5, Minecraft 1.13-pre6, Minecraft 1.13-pre7, Minecraft 1.13-pre8, Minecraft 1.13-pre9, Minecraft 1.13, Minecraft 18w30a, Minecraft 18w30b, Minecraft 18w31a, Minecraft 18w32a, Minecraft 18w33a, Minecraft 1.13.1-pre1, Minecraft 1.13.1-pre2, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 18w45a, Minecraft 18w46a, Minecraft 18w49a, Minecraft 18w50a, Minecraft 19w02a, Minecraft 19w03a, Minecraft 19w03b, Minecraft 19w03c, Minecraft 19w05a, Minecraft 19w06a, Minecraft 19w07a, Minecraft 19w08a, Minecraft 19w08b, Minecraft 19w09a, Minecraft 19w11a, Minecraft 19w11b, Minecraft 19w12a, Minecraft 19w12b, Minecraft 19w13a, Minecraft 19w13b, Minecraft 19w14a, Minecraft 19w14b, Minecraft 1.14 Pre-Release 1, Minecraft 1.14 Pre-Release 2, Minecraft 1.14 Pre-Release 3, Minecraft 1.14 Pre-Release 5, Minecraft 1.14
    • None
    • Confirmed
    • (Unassigned)

      The order in which tagged functions are invoked is not consistent across reloads. The game respects neither the order in which datapacks are enabled nor the order of functions within the tag's definition.

      Expected results

      The expectation is that the invocation order remains consistent across reloads:

      [Server] foo:load1
      [Server] foo:load2
      [Server] foo:load3
      [Server] bar:load1
      [Server] bar:load2
      [Server] bar:load3
      

      See also dinnerquote.png, which is meant to serve as an alternate explanation of the expected behaviour and not an official piece of evidence.

      Actual results

      As evident in reload.png, the tag order is shuffled arbitrarily each time datapacks are reloaded. One iteration yielded the following output:

      [Server] foo:load3
      [Server] bar:load3
      [Server] foo:load1
      [Server] foo:load2
      [Server] bar:load1
      [Server] bar:load2
      

      Details

      The following also produce inconsistent results across reloads:

      /function #foo:load
      /function #bar:load
      /function #foo:tick
      /function #bar:tick
      

      Given that foo and bar are defined in two separate datapacks, we can deduce two problems:

      1. Datapack ordering is not respected; otherwise all invocations of foo functions should come before those of bar.
      2. Function order within the tag definition is not respected; otherwise foo:load1 should be invoked before foo:load2, which in turn should be invoked before foo:load3.

      How to reproduce

      This behaviour can be reproduced by placing both datapacks from the attached datapacks.zip into a world's datapacks folder and running /reload repeatedly. (Datapacks are also available on GitHub.)

      Code Analysis

      Code analysis by liach can be found in this comment

        1. datapacks.zip
          7 kB
        2. dinnerquote.png
          dinnerquote.png
          12 kB
        3. reload.png
          reload.png
          22 kB

            boq [Mojang] Bartosz Bok
            Arcensoth Arcensoth
            Votes:
            22 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: