The bug
When several entities call a function within another function, the selected order of entities is in reverse order. Selectors should have consistent sorting—that is, from nearest to furthest.
Steps to reproduce:
Open the provided world, stand near one of the sets of stairs, and run
/function sort_entities.Observe the results. The chat will print the following: a regular
/tellrawmessage listing the three entities by name; each entity will call a function that prints their own name in chat; and each entity will print their name in chat without calling a function.
The expected behavior is all three should sort the entities the same way, but the "With function:" line prints the entities in reverse order.
(Note that this problem does not occur if the same command within the "sort_entities" function is called directly in chat.)
/execute @e[type=bug:sample_entity] ~ ~ ~ function print_name
If the list of entities was 1, 2, and 3, the results should print this:
Updated the ticket to more accurately describe the bug.