-
Bug
-
Resolution: Duplicate
-
None
-
Minecraft 1.13.1
-
None
-
I tested this in a normal superflatt world, which I opened to lan to join with 2 other accounts.
The world was generated in 1.13.1, and all the commands were written in 1.13.1.
-
Unconfirmed
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
- "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"
- duplicates
-
MC-126946 Execution order is reversed when calling a function in some cases
- Resolved