-
Bug
-
Resolution: Awaiting Response
-
None
-
1.21.20.24 Preview, 1.21.30.22 Preview
-
None
-
Confirmed
-
Windows
Explanation
The Player method "addExperience" only removes the player's XP until the level cap is reached. For example, if a player is at XP level 5 and calls the method: :addExperience(-500) It will not change the player's level, instead they will be at level 5 with no extra XP.
It should also be noted that unlike negative parameters, using positive parameters can increment the player's level. This test is also done using the 1.15-beta scripting version.
Steps to Replicate
- Download the add-on
- Open Minecraft Preview 1.21.20.24
- Create a world using this add-on
- Use command: "give @s sky:skulk_battery"
- Use the item, which uses a custom component, to run the following line that will increase or decrease XP based on a 50% percent chance.
Math.random() < 0.5 ? arg.source.addExperience(1000) : arg.source.addExperience(-1000);
- Notice how the XP level never decreases for the player.