NullPointerException
jmilthedude opened this issue ยท 2 comments
In some cases, when ServerGamePacketListenerImplMixin calls SoundSuppressionHelper.shouldSuppressSoundEventFor() and passing player.level().getEntity(soundPacket.getId()), the getEntity() call can return null, causing a NullPointerException when calling entity.position() in Line 85 of SoundSuppressionHelper as noted above.
Fix: Add a null check for the entity before calling position() is the simplest approach.
Thank you for the issue report! I will fix this in the coming days (feel free to remind me if I forget, lol), however this is not solely Vanishmod's fault, as sending a ClientboundSoundEntityPacket as opposed to a regular ClientboundSoundPacket while not providing an actual entity is very strange in my opinion (and mods doing so are lucky that the client doesn't crash from that).
No worries and thanks for the reply! It's actually not a null entity. Rather, the ID is out of sync for some reason in this case. The client does not have the ID for that entity so when level.getEntity(id) is called, it finds nothing. Who knows why, I haven't fully debugged that. Some other mod I'm sure.