UtilitiX

UtilitiX

2M Downloads

Trying to store large xp amounts in experience crystal does nothing

iTrooz opened this issue ยท 1 comments

commented

Minecraft version

1.20.1

LibX version

1.20.1-5.0.1

UtilitiX version

1.20.1-0.8.0 - Commit 0c849aa

Forge version

47.1.3

The latest.log file

None

Issue description

Trying to place too much xp (e.g. 30000 levels) in the experience crystal does nothing
. This is due to https://github.com/MelanX/UtilitiX/blob/bc86782adffd1bd9b24d69ef8b243fa63ef80344/src/main/java/de/melanx/utilitix/util/XPUtils.java#L44 overflowing the int into a negative number.

Steps to reproduce

  • Place experience crystal
  • /xp set @p 30000 levels
  • Try to place the experience in the crystal: Nothing will happen

Other information

To fix this getExpPoints() should probably return a long in any case, but I'm not sure how you want to handle large amounts of experience: keep the current (int) maximum, and only fill the crystal to this maximum, or use a long for experience storage as well ?

commented

Thanks for that additional information with code example! That helped a lot. I had some performance issues when using long for storing xp, that's why I used int instead. I think I found a solution for this performance issue, and will try to switch to long in 1.21. I don't want to risk anything in 1.20 with compatibility problems, and maybe deleted xp crystals.