Refreshment Crashes Game By Passing -1 As An Index To An Array
SpaceDragon00 opened this issue ยท 6 comments
Describe the bug
Trace of methods:
- Living entity onDeath() method is called
- MCDW applyRefreshment() method is called
- MCDW systematicReplacePotions() method is called
- getStack is called on the player inventory
- DefaultedList get() method is called
- Index out of bounds error occurs
Please complete the following information:
- OS: Windows
- Launcher: CurseForge
- Mod Version 4.3.2
- Are you using a Modpack? Yes, Cam SMP (CurseForge)
Additional context
Full crash report with additional context:
crash-2022-06-20_10.09.20-server.txt
Thanks for this crash report. Please keep in mind that we only develop for the latest version of Minecraft so any bug fixes will likely only be released for 1.19. Would you also mind provided a little bit of context as to what you were doing when it happened? It will help us in trying to recreate the issue.
Sure thing, I only learned just recently since it happened to another player; I'm just the only person on the server who knows about code. It's entirely possible this bug isn't the fault of your mod, as it resulted from one of the players killing mobs with the "Sniper Sword" from Gobber, which bafflingly transfers its melee weapon enchantments to the arrows it fires. If you can't find anything wrong with your code, I'll raise it as a minor incompatability issue on the Gobber page
To clarify: The user was killing enemies with a Sniper Sword with the Refreshing enchant, which I imagine causes issues since it is deliberately separated from the Refreshment Shot enchant
Ah, okay. Thanks for those details! We can definitely take a look at that :D
Hey @SpaceDragon00! I tested Gobber2 with the latest version of MCDW (4.4.0) on 1.18.2 and 1.19 and I cannot reproduce the crash. It is possible that there were a number of other enchantments that were on the sword that were causing the issue as nothing was changed with respect to the code for Refreshment
between versions. However, if you would like to try updating to 4.4.0 to see if your issue still persists, please note that there is a very high likelihood that people will lose their MCDW weapons because we went back to EnchantGiver for innate enchantments which changes the NBT of the items.
I'll leave the issue open for a day, just in case you're able to provide any updates. :)
So, it turns out that a bug was found in the Refreshment code, but it doesn't appear that it would have caused this issue. Returning a value of -1 would indicate that an inventory wasn't found, which makes me think that something might happening with a mod conflict, especially since the arrow is ticking. I'm going to close this issue, for now, since we've been unable to reproduce it.
Thanks for helping us find the other bug, though!