mojira.dev
MC-176901

Statistics freeze at signed 32 bit integer limit

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

Linked issues

Attachments

Comments 6

Confirmed in 20w15a

Confirmed in 20w28a

Confirmed in 20w48a

Can confirm in 20w51a.

Can confirm in 21w03a.

Can confirm in 1.17.1.

skyrising

(Unassigned)

Confirmed

Platform

Low

Statistics

20w13b, 20w15a, 20w28a, 1.16.2 Pre-release 1, 1.16.3, ..., 20w51a, 21w03a, 1.17.1, 24w13a, 1.21.4

Retrieved