bl4ckscor3 / GlobalXP

Adds a block to store XP accessible to all players
https://curseforge.com/minecraft/mc-mods/global-xp
MIT License
7 stars 6 forks source link

[1.12] More XP than what I have on hand is deposited #15

Closed DoomRater closed 5 years ago

DoomRater commented 5 years ago

After I retrieve experience for an anvil repair, a deposit somewhere else, or an enchantment, when I go to deposit the remaining XP again it acts like I never spent it to begin with. I'm baffled as to why this is happening.

bl4ckscor3 commented 5 years ago

This is caused by Minecraft handling XP in a weird way. I am aware of this issue already, but it doesn't seem like I can do anything against it.

DoomRater commented 5 years ago

I took a peek at how OpenBlocks and by extension the OpenMods EnchantmentUtils class AddPlayerXP does it. It seems to be doing a lot of calculations and then setting the player's experience directly instead of calling a method to change the player's XP. In fact, there's a comment in there about how Minecraft doesn't update experienceTotal properly, so they use a workaround. https://github.com/OpenMods/OpenModsLib/blob/master/src/main/java/openmods/utils/EnchantmentUtils.java

bl4ckscor3 commented 5 years ago

Thanks, I will take a look at it.