-
Bug
-
Resolution: Unresolved
-
None
-
Minecraft 1.11.2, Minecraft 1.12 Pre-Release 6, Minecraft 1.13.2, Minecraft 19w08b, Minecraft 19w09a, Minecraft 1.14.3, 1.15.1, 1.15.2, 20w17a, 1.16.2, 1.16.4, 20w48a, 21w03a, 21w05b, 1.17.1, 21w43a, 1.19.3, 23w05a, 1.21.3, 24w45a
-
Confirmed
-
Commands
-
Normal
-
Platform
The bug
The value of the XpTotal tag of a player which is used as value for scoreboard objectives of the criteria type xp and the query result of the /xp command when giving experience (not levels) does not account for level changes.
It is basically the number of experience the player has collected. It only resets to 0 when the player would have a negative experience level.
Affected events:
- Enchanting
- Using an anvil
- Adding or removing levels using /xp
How to reproduce
- Create a scoreboard objective tracking the xp of a player
/scoreboard objectives add xp xp /scoreboard objectives setdisplay sidebar xp
- Use for example the /xp command
/xp add @s 10 levels
The score does not update
Code analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
The tag XpTotal (field net.minecraft.entity.player.EntityPlayer.experienceTotal) is only increased by the method net.minecraft.entity.player.EntityPlayer.addExperience(int) and additionally never decreased.
- is duplicated by
-
MC-145123 XpTotal not updating if you manually set your XP
- Resolved
-
MC-149216 Experience used in anvil/enchantment table doesn't count in the xp criteria scoreboard objectives.
- Resolved
-
MC-152585 playerdata XpTotal does not update itself when changing Xp with "/xp set"
- Resolved
-
MC-156797 Querying Player XP Score to Scoreboard
- Resolved
-
MC-240242 1.17 Experience Scoreboard Broken
- Resolved
- relates to
-
MC-123270 Inconsistent xp and level value
- Resolved