ChaoticTrials / UtilitiX

Nice to have items, blocks, and other features.
https://modrinth.com/mod/utilitix
Apache License 2.0
7 stars 3 forks source link

Trying to store large xp amounts in experience crystal does nothing #62

Closed iTrooz closed 4 months ago

iTrooz commented 4 months ago

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

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 ?

MelanX commented 4 months ago

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.