QueryResult for xp command uses previous value
The bug
When you use the QueryResult stat in combination with the /xp command, the query result value is the previous value. This affects adding / removing experience and adding / removing levels.
How to reproduce
- /scoreboard objectives add xpLevels dummy
- /scoreboard objectives setdisplay sidebar xpLevels
- /scoreboard players set @p xpLevels 0
- /stats entity @p set QueryResult @p xpLevels
- /xp 1L
→ The score has your previous xp level count as value
The reason
The following is based on a decompiled version of Minecraft 1.9 using MCP 9.24 beta.
The reason for this is that the method net.minecraft.command.CommandXP.execute(MinecraftServer, ICommandSender, String[]) first sets the query result value and then changes the experience value.
Linked Issues
relates to1
Created Issue:
QueryResult for xp command uses previous value
Relates to
MC-80511The bug
When you use the QueryResult stat in combination with the /xp command, the query result value is the previous value. This affects adding / removing experience and adding / removing levels.
How to reproduce
- /scoreboard objectives add xpLevels dummy
- /scoreboard objectives setdisplay sidebar xpLevels
- /scoreboard players set @p xpLevels 0
- /stats entity @p set QueryResult @p xpLevels
- /xp 1L
→ The score has your previous xp level count as valueThe reason
The following is based on a decompiled version of Minecraft 1.9 using MCP 9.24 beta.
The reason for this is that the method net.minecraft.command.CommandXP.execute(MinecraftServer, ICommandSender, String[]) first sets the query result value and then changes the experience value.
Relates to
MC-80511The bug
When you use the QueryResult stat in combination with the /xp command, the query result value is the previous value. This affects adding / removing experience and adding / removing levels.
How to reproduce
- /scoreboard objectives add xpLevels dummy
- /scoreboard objectives setdisplay sidebar xpLevels
- /scoreboard players set @p xpLevels 0
- /stats entity @p set QueryResult @p xpLevels
- /xp 1L
→ The score has your previous xp level count as valueThe reason
The following is based on a decompiled version of Minecraft 1.9 using MCP 9.24 beta.
The reason for this is that the method net.minecraft.command.CommandXP.execute(MinecraftServer, ICommandSender, String[]) first sets the query result value and then changes the experience value.
relates to
Is this still an issue in the latest snapshot 16w44a? If so please update the affected versions.
This is an automated comment on any open or reopened issue with out-of-date affected versions.
Is this still relevant at all?
No probably not. It appears the experience command now returns the number of affected players and the not the result experience value.
Resolved this report as Invalid therefore.