Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE crash is caused by ItemMixin when a sword or shield that has no NBT tags is in the player's inventory #7

Open
EtiTheSpirit opened this issue Jan 29, 2023 · 2 comments

Comments

@EtiTheSpirit
Copy link

EtiTheSpirit commented Jan 29, 2023

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}

@EtiTheSpirit EtiTheSpirit changed the title NPE is raised by ItemMixin when a shield that has no NBT tags is in the player's inventory. NPE is raised by ItemMixin when a sword or shield that has no NBT tags is in the player's inventory. Jan 29, 2023
@EtiTheSpirit EtiTheSpirit changed the title NPE is raised by ItemMixin when a sword or shield that has no NBT tags is in the player's inventory. NPE crash is caused by ItemMixin when a sword or shield that has no NBT tags is in the player's inventory Feb 11, 2023
@equinox1212
Copy link

equinox1212 commented Apr 11, 2023

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.

@NumanSadik
Copy link

Dwarven sword from Iter RPG also causes a crash when in inventory.
crash-2024-12-19_14.49.50-server.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants