| Type: | Bug | ||
| Reporter: | [Helper] Lord_Quadrato | Assignee: | [Mojang] etanaratsastaja |
| Resolution: | Fixed | Votes: | 50 |
| Labels: | experience, overflow | ||
| Attachments: |
|
||||||||||||||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||
| CHK: | |||||||||||||||||||||||||||||||||||||
| Confirmation Status: | Confirmed | ||||||||||||||||||||||||||||||||||||
| Category: |
Player
|
||||||||||||||||||||||||||||||||||||
| Mojang Priority: | Low | ||||||||||||||||||||||||||||||||||||
| Area: | Platform | ||||||||||||||||||||||||||||||||||||
| Description |
The bugThe XP level can overflow causing the experience bar to disappear. How to reproduce
So, maximum player's level is 2^31 - 1, after which the level overflows and is treated as 0. The possible solution (suggested by mustek) is to cap maximum level. |
| Comments |
| Comment by [Mod] Avoma [ 06/Aug/22 ] |
|
Can confirm in 1.19.2. |
| Comment by Fabian Röling [ 23/Jul/22 ] |
|
HubbiGamingTV Could you please not go through tons of tickets, making either obvious/redundant (MC-201, MC-1531, |
| Comment by HubbiGamingTV [ 22/Jul/22 ] |
|
this is because of the 32 signed bit integer limit (2,147,483,647) after this number the game automaticly resets your level to 1. this happends because of the way how the xp level is stored
|
| Comment by [Mod] Avoma [ 08/Jun/22 ] |
|
Can confirm in 1.19. |
| Comment by [Mod] Avoma [ 02/Mar/22 ] |
|
Can confirm in 1.18.2. |
| Comment by [Mod] Avoma [ 14/Dec/21 ] |
|
Can confirm in 1.18.1. |
| Comment by [Mod] Avoma [ 04/Oct/21 ] |
|
Can confirm in 21w39a. |
| Comment by [Mod] ampolive [ 15/Jul/21 ] |
|
Can confirm in 1.17.1. |
| Comment by [Mod] Avoma [ 08/May/21 ] |
|
Can confirm in 1.16.5 and 21w18a. |
| Comment by [Mod] Avoma [ 30/Apr/21 ] |
|
Can confirm in 21w17a. |
| Comment by [Mod] Avoma [ 19/Apr/21 ] |
|
Can confirm in 21w15a. |
| Comment by [Mod] Avoma [ 11/Apr/21 ] |
|
Can confirm in 21w14a. |
| Comment by [Mod] Avoma [ 06/Apr/21 ] |
|
Can confirm in 21w13a. |
| Comment by [Mod] Avoma [ 27/Mar/21 ] |
|
Can confirm in 21w11a. |
| Comment by [Mod] Avoma [ 18/Feb/21 ] |
|
Can confirm in 21w07a. Video attached. |
| Comment by [Mod] Avoma [ 12/Feb/21 ] |
|
Can confirm in 21w06a. |
| Comment by [Mod] Avoma [ 04/Feb/21 ] |
|
Can confirm in 21w05b. |
| Comment by [Mod] Avoma [ 22/Jan/21 ] |
|
Can confirm in 21w03a. |
| Comment by [Mod] Avoma [ 24/Dec/20 ] |
|
Can confirm in 20w51a. |
| Comment by [Mod] Avoma [ 25/Nov/20 ] |
|
Can confirm in 20w48a. |
| Comment by ouroya [ 18/Nov/20 ] |
|
@Marcono1234, In survival, the maximum level is much less than 2^31-1, as the amount of xp points (not levels) is capped at the 32-bit limit, restricting you to level 21863. Rays Works on youtube has demonstrated this in vanilla survival on the ProtoTech server, using a very powerful XP farm which he ran for multiple weeks. |
| Comment by pulpetti [ 19/Jul/20 ] |
|
In 1.16.1 and 20w29a. |
| Comment by Marcono1234 [ 28/May/20 ] |
|
@FaRo1, Math.addExact throws an exception on overflow which would not be helpful here. Capping the value at the maximum positive value sounds reasonable especially since such high XP levels can likely not be obtained in Survival anyways. |
| Comment by Fabian Röling [ 26/May/20 ] |
|
Java already has Math.addExact, which doesn't allow overflows. The fix is just to use that. Using a bigger number type would not fix the problem, just postpone it. |
| Comment by Robin Lindner [ 26/May/20 ] |
|
You could turn the signed 32-bit integer into a signed 64-bit integer, but this requires 4 bytes more per player in the player data. Sure, this might be a bit small-minded, but is it really necessary to have such a high-level number? This is hardly playable in Survival? A solution would be a BigInt which is then saved as a string in the world file. Unfortunately Java does not support unsigned integer, so you would have to write a wrapper around the integer to only cut the negative range. |
| Comment by W_V [ 14/Dec/19 ] |
|
Happening in 1.15 and its snapshots. And in 1.15.1 Pre-Release 1. |
| Comment by [Mod] Pokechu22 [ 25/Apr/18 ] |
|
Thanks. I'd updated my setup in my world for this with the new commands, but never updated the ticket. |
| Comment by [Helper] Lord_Quadrato [ 25/Apr/18 ] |
|
Still present in 18w16a. |
| Comment by Ktoś Ktosiowski [ 30/Jun/17 ] |
|
Confirmed for 1.12 |
| Comment by user33 [ 28/Apr/17 ] |
|
Confirmed for 17w17b. |
| Comment by . [ 12/Apr/17 ] |
|
Confirmed for 17w15a. |
| Comment by . [ 08/Feb/17 ] |
|
Confirmed for 17w06a. |
| Comment by . [ 14/Nov/16 ] |
|
Confirmed for 1.11. |
| Comment by . [ 08/Nov/16 ] |
|
Confirmed for 1.11-pre1. |
| Comment by [Mod] Pokechu22 [ 29/Jun/16 ] |
|
FYI: the term is "overflow", not "overfloat". |
| Comment by Marcono1234 [ 05/Feb/16 ] |
|
Confirmed for
|
| Comment by Itouch2 [ 13/Jul/15 ] |
|
confirmed for 1.8.7 |
| Comment by Marcono1234 [ 17/May/15 ] |
|
Confirmed for |
| Comment by [Mod] Ezekiel (ezfe) [ 26/Jul/14 ] |
|
Is this still a concern in the latest Minecraft version 14w30c? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases. |
| Comment by Tails [ 15/Mar/13 ] |
|
Is this still a concern in the current Minecraft version? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases. |
| Comment by Jonathan Haas [ 14/Dec/12 ] |
|
Another option would be to use BigInteger instead of int. But capping seems reasonable. |
| Comment by Jonathan Haas [ 17/Nov/12 ] |
|
Also, Java doesn't really support unsigned ints well. |
| Comment by Norrius [ 17/Nov/12 ] |
|
Well, you're right, Mustek. Capping is much better way. |
| Comment by Mustek [ 17/Nov/12 ] |
|
I think the solution here is not to make this an unsigned int, but to simply cap the max level so it doesn't happen. |