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

Performing an operation on a scoreboard that got its result from stats returns a constant incorrect result

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • Minecraft 1.12.1
    • Windows 8.1 x64
      Java 8u131 x64
      intel core i7-4770 stock clock speed (3.4Ghz)
      Windowed 1920x1080
      GeForce GTX660 x2 SLI
    • Unconfirmed

      Running the following code in a function:

      scoreboard objectives add TempA dummy
      scoreboard players set @s TempA 0
      stats entity @s set SuccessCount @s TempA
      testfor @a {Dimension:0}
      tellraw @a [{"text":"Dims "},{"score":{"name":"@s","objective":"TempA"}}]
      scoreboard players set @s[score_TempA_min=2,score_GM4_BBLoops_min=300] GM4_BBNState 6
      
      scoreboard objectives add TempB dummy
      scoreboard players set @s TempB 0
      stats entity @s set SuccessCount @s TempB
      testfor @a {Sleeping:1b}
      tellraw @a [{"text":"Sleeps "},{"score":{"name":"@s","objective":"TempB"}}]
      scoreboard objectives add TempC dummy
      scoreboard players set @s TempC 0
      scoreboard players operation @s TempC = @s TempB
      scoreboard players operation @s TempC -= @s TempA
      tellraw @a [{"text":"Delta "},{"score":{"name":"@s","objective":"TempC"}}]
      #scoreboard players set @s[score_TempA_min=0,score_TempA=0,score_GM4_BBLoops_min=90] GM4_BBNState 6
      
      scoreboard objectives remove TempA 
      scoreboard objectives remove TempB 
      scoreboard objectives remove TempC
      

      I've been noticing that any time I run a testfor command that looks for data tags after a stats command, the result would sometimes be constantly wrong (usually resulting in 1)

      Sometimes I can get around this by changing the scoreboards name (I did that here with Temp A, B, and C, they were originally another scoreboard) but I noticed the problem persists if you try to perform an operation on the scoreboard after acquiring the stats.
      e.g. the code:

      scoreboard players operation @s TempC = @s TempB
      scoreboard players operation @s TempC -= @s TempA
      

      was originally:

      scoreboard players operation @s TempB -= @s TempA
      

      TempC was not used, but this resulted in -1

      it was then changed to:

      scoreboard players operation @s TempC = @s TempB
      scoreboard players operation @s TempC -= @s TempA
      

      This resulted in 0

      I then changed it to:

      scoreboard players operation @s TempC = @s TempA
      

      This resulted in 1.

      based on this, it appears TempA and TempB are both set to 1 regardless of what the stats result is, however the result of this function is:
      Dims # (Changes depending on how many people are online and in the overworld)
      Sleeps # (Changes depending on how many people are in bed)
      Delta 1 (always returns 1 even though it should return the difference between the two numbers)

      before I switched scoreboards, both Dims and Sleeps returned 1 as well

      This tells me that you can use the scoreboard in a selector and in tellraw, and it returns the true value, but using it in a scoreboard operation returns 1.

      The function is located at gm4:modules/better_beds/state/5

      Hopefully this is enough information to recreate the problem.
      I know this is a problem because I've encountered this numerous times and have also seen many people encounter it as well. reloading or restarting the game doesn't fix this, nor does removing and re-adding the scoreboard objective.

      Please thoroughly investigate, as this problem affects a lot of my functions and I would like for it to be resolved!

      functions folder available upon request

            Unassigned Unassigned
            n00b_asaurous n00b_asaurus
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: