GM4_Datapacks
GM4_Datapacks copied to clipboard
Sneak-depositing 800 or more levels exceeds the max command length
Describe the bug
It is possible to hit the max command chain length limit (65536). This will cause the gm4_xp_storage:main function to stop running.
To Reproduce
Steps to reproduce the behavior:
-
/xp set @s 800 levels - Stand on an enderchest and deposit one level
- Sneak and notice your xp level drops to 749
- Notice you can no longer deposit xp and the actionbar message is not appearing anymore
Fix
This is a temporary fix, but decreasing the 50 levels limit would decrease the chance of this happening in survival. In the future we should look into optimizing the xp depositing algorithm.
Using macros we can now directly update XP from the scoreboard value, negating the need to recurse at all.
@Bloo-dev was this issue fully fixed by #1190?