Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-123078

Scoreboard ranges don't work correctly at extreme values

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 1.13-pre6
    • Minecraft 17w49a, Minecraft 17w49b, Minecraft 17w50a, Minecraft 18w01a, Minecraft 18w02a, Minecraft 18w03b, Minecraft 18w05a, Minecraft 18w06a, Minecraft 18w07a, Minecraft 18w07b, Minecraft 18w07c, Minecraft 18w08a, Minecraft 18w08b, Minecraft 18w09a, Minecraft 18w10a, Minecraft 18w10b, Minecraft 18w10c, Minecraft 18w10d, Minecraft 18w11a, Minecraft 18w14a, Minecraft 18w14b, Minecraft 18w15a, Minecraft 18w16a, Minecraft 18w19a, Minecraft 18w20c, Minecraft 18w21a, Minecraft 18w21b, Minecraft 18w22a, Minecraft 18w22b, Minecraft 18w22c, Minecraft 1.13-pre1, Minecraft 1.13-pre2, Minecraft 1.13-pre3, Minecraft 1.13-pre4, Minecraft 1.13-pre5
    • None
    • Confirmed

      I suspect that this bug comes from the fact that when the ranges are checked the scoreboard value is cast to single precision floating point when checking, which causes the ranges to behave unexpectedly. This is evidented by the fact that

      @e[scores={test=1000000000000000000000000}]

      is not checked.

      Interestingly,

      @e[scores={play=1.5}]

      is checked.

      To reproduce:

      1. Create a new world and create a new dummy scoreboard objective test
      2. run:

      /scoreboard players set @p test 16777214
      /execute as @e[scores={test=16777215}] run say hi
      /scoreboard players set @p test 16777215
      /execute as @e[scores={test=16777215}] run say hi
      /scoreboard players set @p test 16777216
      /execute as @e[scores={test=16777215}] run say hi
      

      In this case, the command should only run when your test score is exactly 16777215 (2^24-1), as expected.

      3. run:

      /scoreboard players set @p test 16777215
      /execute as @e[scores={test=16777216}] run say hi
      /scoreboard players set @p test 16777216
      /execute as @e[scores={test=16777216}] run say hi
      /scoreboard players set @p test 16777217
      /execute as @e[scores={test=16777216}] run say hi
      /scoreboard players set @p test 16777218
      /execute as @e[scores={test=16777216}] run say hi
      

      In this case, the command should only run when your test score is exactly 16777216 (2^24). However, it also runs when your test score is 16777217 (2^24+1), as (float)16777216==(float)16777217.

            boq [Mojang] Bartosz Bok
            elyg Ely G
            Votes:
            10 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: