mojira.dev
MC-247634

minimum score range for alternative value_check in predicate not working correctly

I tried to create a predicate for checking if there are enough players to start a game for my datapack, depending on the map.  In my example, the score of #map in mas.ids contains the id of the map and the score of #players in mas.counters contains the player count, but this issue obviously arises for any scoreboard/dummy.

I've attached the predicate itself as a json file but the general logic of it should be:
if (map 0 AND 2+ players) OR (map 1 AND 4+ players) OR (map 2 AND 6+ players).
However, the observed effect using execute if predicate is that the tests succeed when there are 6+ players for maps 0 and 1, and 4+ players for map 2.
I tried it again with 4 maps and the same logic held (i.e. map0->min8, map1->min8, map8->min6 instead of map0->min2, map1->min4, map2->min6, map3->min8).
When I tried inverting the minimum player requirements (i.e. map0->min6, map1->min4, map2->min2) the outcome was inverted too (i.e. map0->min4, map1->min6, map2->min6).

Thus, I concluded:
All minimums below the largest minimum, are treated as the largest minimum, and the largest minimum is treated as the second largest minimum.

I have no idea why this is the case and apologize if the explanation is a bit unclear, it's difficult to explain such a specific bug. You can recreate it consistently though, using the set up I described. If you use the predicate file I attached, you can use the following commands to test it (after adding the two scoreboards).

scoreboard players set #map mas.ids 0
scoreboard players set #players mas.counters 2
execute if predicate mas:min_players
scoreboard players set #players mas.counters 4
execute if predicate mas:min_players
scoreboard players set #players mas.counters 6
execute if predicate mas:min_players
# set map to 1, repeat, set map to 2, repeat, etc

You'll see that the tests for 2 and 4 players fail for every map (except the one that should have 6 as a minimum, which actually has 4 as a minimum), and that only the test for 6 succeeds for them all.

Attachments

Comments 1

Hello, I think I may have just misunderstood the way the predicates work, please feel free to close this issue. Sorry!

Lord Kanelsnegle

(Unassigned)

Unconfirmed

(Unassigned)

predicate, value_check

1.18.1

Retrieved