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

Statistics freeze at signed 32 bit integer limit

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 20w13b, 20w15a, 20w28a, 1.16.2 Pre-release 1, 1.16.3, 1.16.4, 20w48a, 20w51a, 21w03a, 1.17.1, 24w13a
    • None
    • Confirmed
    • Statistics
    • Low
    • Platform

      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
        

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

            Unassigned Unassigned
            skyrising skyrising (Simon Wanner)
            Votes:
            21 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              CHK: