Mojira Archive
MC-126946

Execution order is reversed when calling a function in some cases

How to reproduce

  • Summon 3 armor stands
    summon minecraft:armor_stand ~ ~ ~ {CustomName:"\"Main\"",CustomNameVisible:1b,Tags:["foo"]}
    summon minecraft:armor_stand ~1 ~ ~ {CustomName:"\"One\"",CustomNameVisible:1b,Tags:["bar"]}
    summon minecraft:armor_stand ~2 ~ ~ {CustomName:"\"Two\"",CustomNameVisible:1b,Tags:["bar"]}
    
  • make 2 functions
    #to:foo
    execute as @e[tag=foo] at @s as @e[tag=bar,sort=nearest] run function to:say
    
    #to:say
    say Hello
    
  • /reload and run /function to:foo in chat
    → Notice that "Two" prints its name in chat before "One" while it is further away

Note: When replacing sort=nearest with sort=furthest "One" will print its name first confirming the bug that they are swapped.