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

Statistics freeze at signed 32 bit integer limit

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 20w13b, 20w15a, 20w28a, 1.16.2 Pre-release 1, 1.16.3, 1.16.4, 20w48a, 20w51a, 21w03a, 1.17.1
    • Fix Version/s: None
    • Labels:
      None
    • Confirmation Status:
      Community Consensus
    • Category:
      Statistics
    • Mojang Priority:
      Low

      Description

      The way MC-79944 was fixed the statistics just stay at the maximum value instead of overflowing.
      In practice this technically fixes the overflow issue, but is actually not more useful than going negative.

      From my knowledge of the code I can't see a reason why using a long instead of int (as a commenter on the original report suggested) would not be possible. The storage format (json) would allow for storing numbers up to 2^53 accurately by which point the value of the statistic is way out of reach for any survival player, while reaching 2^31 for example on the 'Distance by Elytra' statistic is possible by actively playing on the same world for a few months.

      Reproduction Steps (slightly adjusted from https://bugs.mojang.com/browse/MC-79944?focusedCommentId=633888 ):

      1. Summon a few zombies with
        /summon zombie ~ ~ ~ {HandItems:[{id:"diamond_axe",Count:1,tag:{Enchantments:[{id:"sharpness",lvl:2147483647}]}},{}]}
        
      2. Give yourself resistance
        /effect give @s minecraft:resistance 1000000 4 true
        
      3. and resist the damage in survival mode
        /gamemode survival
        

        Attachments

        1. MC-176901.mp4
          6.17 MB
        2. MC-176901.png
          MC-176901.png
          1.38 MB

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              skyrising skyrising (Simon Wanner)
              Votes:
              15 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                CHK: