Jade ๐Ÿ”

Jade ๐Ÿ”

93M Downloads

[NeoForge 1.20.2] Crash when looking at non-pickable entity

RedstoneDubstep opened this issue ยท 0 comments

commented

Mod loader

NeoForge

Minecraft version

1.20.2

Mod version

12.1.7

Modloader version

20.2.21-beta

Modpack info

No response

If bug:

  • Can you reproduce this issue with relevant mods only?

If bug: The latest.log file

https://gist.github.com/RedstoneDubstep/9f7aac0136571574e709543368b59843

Issue description

Whenever the player looks at an entity that has no pick block interaction defined (so you don't get an item when you use the "Pick Block" key on it), the client crashes. This includes, for example, all projectiles like Arrows and Fireballs as well as other players.

The relevant Jade code is in EntityAccessorClientHandler#getIcon, which uses the picked result of the looked-at entity to try to generate an icon. However, this code doesn't contain a check for whether the picked result doesn't exist (and the returned ItemStack is thus null), so the game crashes with a NullPointerException when getItem() is invoked on the null stack.
(Note: This wasn't an issue in the Forge implementation of Jade, because in Forge, IForgeEntity#getPickedResult always returned an optionally empty ItemStack, which is no longer the case in NeoForge where nullreturn values from that method can and will happen.)
PS: I was only able to reproduce this in a development environment because it's currently impossible to install NeoForge on PrismLauncher, but judging by the way the issue occurs I'm very sure that this crash also happens in a production environment.