mojira.dev
MC-136854

sort=nearest / furthest do the opposite of what tehy are supposed to do.

to reproduce: "coppy" my setup as discribed below:

I encounterd this bug while I wtied to make a datapack which sorts all players by distance to a given entity. I did this by creating 2 functions:

1. run.mcfunction

  • scoreboard players set count distancecount 0

  • execute as @a[sort=nearest] run function distancesort:sort

2. sort.mcfunction

  • scoreboard players ass count distancecount 1

  • scoreboard players operation @s distonacecount = count distancecount

to start I use this command:

  • execute as @e[name=freeze] at @s run function distancesort:run

  1. "freeze" is the only armorstand in the map. And the only entity with that name.

explination:

with the start command I sett the postition of where the commands shall be executed to the position of the "freeze" armorstand.
Then the fakeplayers "count" distancesort is set to 0.
The execute then calls the "sort" function for every player in the wrld, because of the selector "@a[sort=nearest]" the player closest to the armorstand should call the function first.
When a player calls/runs the "sort" function, he increases "count" distancesort by 1. And then sets "count" distancesort to his own distancesort scoreboard.

The problem:

when using the selector "@a[sort=nearest]" the player furthest away from the armorstand runs the function first.
And when using the selector "@a[sort=furthest]" the player nearest to the armorstand runs the function first.
Basicly the selector doese the opposite of what is says.

2018-9-11_14.25.51 was taken with "@a[sort=nearest]"
2018-9-11_14.26.07 was taken with "@a[sort=furthest]"
the player with the rainbow-skin is "IrgendwasMitPat"

Linked issues

Attachments

Comments 3

Does MC-126946 describe your issue?

It showcases the same effect. (My report also proves that the reversing also happens when calling functions)
Tanks for your time!

Excellent! I have linked the two tickets. Feel free to add any additional info to the parent report.

Wleklik, Patrik

(Unassigned)

Unconfirmed

Minecraft 1.13.1

Retrieved