NPE crash is caused by ItemMixin when a sword or shield that has no NBT tags is in the player's inventory
EtiTheSpirit opened this issue ยท 1 comments
This issue was originally reported on my own mod's repository, see The Ori Mod :: Issue #17.
After reading the crash log coupled with this mod's source, I have isolated the cause to ItemMixin.java L38. This line does not first verify that ItemStack#hasTag()
is true
, causing it to call CompoundTag#contains
on a null
reference. (n.b. these names are declared in mojmap, so naturally the names seen in this mod's source may be slightly different, ymmv).
This error soft-locks the player's save file, requiring them to use a tool like NBTEdit to manually remove the item from their inventory before they can rejoin their world. It can be bypassed by manually giving the player the applicable item with a tag attached via the /give
command. The content of the tag does not matter, just so long as NBT data exists /give @p mod:item{asdfg:0b}
I've been able to replicate this issue with the Aquaculture fillet knife and the Red Matter sword in ProjectE.
Here is an example of the crash with the neptunium fillet knife. It's a similar issue, because the knife is unbreakable it doesn't have a compound tag, causing the player to be soft-locked upon placing the item in their inventory.