Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-123270

Inconsistent xp and level value

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 1.12.2, Minecraft 17w50a, Minecraft 1.13, Minecraft 18w30b, Minecraft 18w31a, Minecraft 18w32a, Minecraft 18w33a, Minecraft 1.13.1-pre1, Minecraft 1.13.1, 1.15.1, 1.15.2, 20w10a, 20w27a, 1.16.4, 20w49a, 21w03a, 21w05b
    • Fix Version/s: None
    • Labels:
      None
    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      When the player has 2920 xp, he is supposed to just reach lvl 40, but depending on how you get the amount of xp, you can end up being lvl 39 with a maxed out xp bar.

      Use these commands to set up and reset the xp value :

      /xp set @p 0 levels
      /xp set @p 0
      /gamemode survival @p
      

      Commands in this order result with lvl 40 :

      /xp add @s 2000
      /xp add @s 920
      

      Commands in this order result with lvl 39 and maxed out xp bar :

      /xp add @p 920
      /xp add @p 2000
      

      This is caused by the experience value still being stored as float and used in calculation, sometimes the condition while(this.experience >= 1.0) is failing when this.experience is barely equals to 1.0 due to float precision error.
      Note that no experience points are ever lost in either process.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              mrpingouin1 [Helper] mrpingouin1
              Votes:
              13 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                CHK: