Java Edition.png

Java Edition:Invalid Experience Level

From Minecraft Discontinued Features Wiki
Jump to navigation Jump to search
Greater than max level.png

The calculations governing experience have changed multiple times throughout Minecraft's history, and these changes have resulted in certain experience levels being impossible to achieve in later versions.

Obtaining

Beta 1.8 Pre-release to Beta 1.9 Prerelease 3

In these versions, the experience required per level is governed by the following equation:

( level + 1 ) * 10

While this can cause the experience required per level to roll over to negative values due to integer overflow at 214,748,364 levels, levels can still be gained regardless. However, levels will instead be gained in bursts due to how negative numbers influence the experience functions. The highest positive level that can be achieved is 2,147,460,388, which would take 1,288,813,963,319,323,772 total experience points to reach, but if enough experience is gained to trigger the level up loop again, the level will overflow to a negative value. The negative level can even be underflowed back into positives given enough experience. Two notable methods for easily gaining experience in these versions are as follows:

Death Duplication

In Beta 1.8 Pre-release and Pre-release 2 ;) servers, the player could die and the XP dropped would double. This can be repeated until the player has more than 20,723 levels, as the total amount of XP collected will overflow to be less than 0 if the player has this much experience, which will cause no experience to drop. Note that this can cause thousands of experience orbs to spawn upon death, which will cause severe lag to the game. This is worse in Beta 1.8 Pre-release 1, as all experience orbs simply had a value of 1, so perform this method in Beta 1.8 Pre-release 2 ;) if you do not want your game becoming a slideshow.

Jump Debug

In Beta 1.9 Prerelease 1, a debug feature was accidentally left in the game that made the player gain XP when they jumped. This can be done indefinitely.

Beta 1.9 Prerelease 4 to 12w02a

In these versions, the experience required per level is governed by the following equation:

7 + ( level * 7 >> 1 )

While this can cause the experience required per level to roll over to negative values due to integer overflow at 306,783,379 levels, levels can still be gained regardless. However, levels will instead be gained in bursts due to how negative numbers influence the experience functions. The highest positive level that can be achieved is 2,147,483,647, which would take 658,812,286,352,677,737 total experience points to reach, but if enough experience is gained to trigger another level up, the level will overflow to a negative value. The negative level can even be underflowed back into positives given enough experience.

1.1 to 12w21a

In these versions, the experience required per level is governed by the following equation:

7 + ( level * 7 >> 1 )

However, a check was added such that the total experience gathered by a player would not exceed the 32 bit integer limit, or 2,147,483,647. This allowed the highest level to be gained by a player to be 35,029 levels.

12w22a

In this version, the experience required per level was hardcoded to 17 points per level. This allowed the highest level to be gained by a player to be 126,322,567 levels, as the total experience point limitation remained.

12w23a to 1.7.10

In these versions, the experience required per level is governed by the following equations:

if ( level >= 30 ) { 62 + ( level - 30 ) * 7 }
if ( level >= 15 ) { 17 + ( level - 15 ) * 3 }
else { 17 }

With the total experience point limitation, these changes placed the maximum experience level at 24,791.

14w02a to 14w03b

In these versions, the experience required per level is governed by the following equations:

if ( level >= 30 ) { 62 + ( level - 30 ) * 7 }
if ( level >= 15 ) { 17 + ( level - 15 ) * 3 }
else { 7 + level * 2 }

With the total experience point limitation, these changes placed the maximum experience level at 24,791.

14w04a to 17w43b

In these versions, the experience required per level is governed by the following equations:

if ( level >= 30 ) { 112 + ( level - 30 ) * 9 }
if ( level >= 15 ) { 37 + ( level - 15 ) * 5 }
else { 7 + level * 2 }

With the total experience point limitation, these changes placed the maximum experience level at 21,863.

17w45a's Commands

Command Block.png
Warning: Requires Cheats 
This feature requires cheats in some way, which may be dangerous. Perform at your own risk.

In the snapshot 17w45a, several commands were accidentally left accessible without cheats[1], including /xp. The command may be used to give any player any level between 0 and 2,147,483,647 with the following syntax: /xp set <player> <amount> levels.

17w45a to 1.21 (present)

In these versions, the experience required per level is governed by the following equations:

if ( level >= 30 ) { 112 + ( level - 30 ) * 9 }
if ( level >= 15 ) { 37 + ( level - 15 ) * 5 }
else { 7 + level * 2 }

The total experience point limitation was removed, instead moving the limit to when the experience per level calculation exceeded the 32 bit integer limit and overflowed, which occurs at 238,609,312 levels. It takes a total of 256,204,778,205,425,054 experience points to reach this point.

Large Level Counts on Multiplayer

Due to the experience packet casting the experience level to a short (-32768 to 32767) on multiplayer servers before release 1.8, it is possible for a negative value to be sent to the client. This will result in the player being unable to enchant or use the anvil due to the client side level not being set correctly.

This was fixed in release 1.8 to write the level as an integer in the packet, as that is the way the level is handled elsewhere.

Videos

References

  1. MC-121656. bugs.mojang.com.