Immersive Engineering

Immersive Engineering

143M Downloads

Powerpack Can Cause Clients to Fail to Connect with NPE In Wire Search Code

voidsong-dragonfly opened this issue ยท 0 comments

commented

Minecraft Version

1.19.2

Immersive Engineering Version

1.19.2-9.2.3-167

Expected Behavior

Clients are able to connect without issue.

Actual Behavior

Certain clients wearing the antenna-upgraded powerpack will fail to connect due to a NPE in the wire search code for the backpack happening on armor tick. I included the pertinent error below, and will link a full log + debug crash in the later part of the issue.

[08Dec2023 23:16:36.834] [Server thread/WARN] [net.minecraft.server.network.ServerConnectionListener/]: Failed to handle packet for /50.30.163.133:4980
net.minecraft.ReportedException: Ticking player
	at net.minecraft.server.level.ServerPlayer.m_9240_(ServerPlayer.java:510) ~[server-1.19.2-20220805.130853-srg.jar%23487!/:?]
	at net.minecraft.server.network.ServerGamePacketListenerImpl.m_9933_(ServerGamePacketListenerImpl.java:264) ~[server-1.19.2-20220805.130853-srg.jar%23487!/:?]
	at net.minecraft.network.Connection.m_129483_(Connection.java:248) ~[server-1.19.2-20220805.130853-srg.jar%23487!/:?]
	at net.minecraft.server.network.ServerConnectionListener.m_9721_(ServerConnectionListener.java:143) ~[server-1.19.2-20220805.130853-srg.jar%23487!/:?]
	at net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:880) ~[server-1.19.2-20220805.130853-srg.jar%23487!/:?]
	at net.minecraft.server.dedicated.DedicatedServer.m_5703_(DedicatedServer.java:292) ~[server-1.19.2-20220805.130853-srg.jar%23487!/:?]
	at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:806) ~[server-1.19.2-20220805.130853-srg.jar%23487!/:?]
	at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:654) ~[server-1.19.2-20220805.130853-srg.jar%23487!/:?]
	at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:244) ~[server-1.19.2-20220805.130853-srg.jar%23487!/:?]
	at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "blusunrize.immersiveengineering.api.wires.localhandlers.EnergyTransferHandler.getSources()" because "energyHandler" is null
	at blusunrize.immersiveengineering.common.items.PowerpackItem.findBestSource(PowerpackItem.java:265) ~[ImmersiveEngineering-1.19.2-9.2.3-167.jar%23389!/:?]
	at blusunrize.immersiveengineering.common.items.PowerpackItem.handleAntennaTick(PowerpackItem.java:211) ~[ImmersiveEngineering-1.19.2-9.2.3-167.jar%23389!/:?]
	at blusunrize.immersiveengineering.common.items.PowerpackItem.onArmorTick(PowerpackItem.java:173) ~[ImmersiveEngineering-1.19.2-9.2.3-167.jar%23389!/:?]
	at blusunrize.immersiveengineering.common.items.PowerpackItem.m_6883_(PowerpackItem.java:286) ~[ImmersiveEngineering-1.19.2-9.2.3-167.jar%23389!/:?]
	at net.minecraft.world.item.ItemStack.m_41666_(ItemStack.java:508) ~[server-1.19.2-20220805.130853-srg.jar%23487!/:?]
	at top.theillusivec4.curios.common.event.CuriosEventHandler.lambda$tick$25(CuriosEventHandler.java:496) ~[curios-forge-1.19.2-5.1.4.3.jar%23350!/:1.19.2-5.1.4.3]
	at net.minecraftforge.common.util.LazyOptional.ifPresent(LazyOptional.java:150) ~[forge-1.19.2-43.3.5-universal.jar%23492!/:?]
	at top.theillusivec4.curios.common.event.CuriosEventHandler.tick(CuriosEventHandler.java:476) ~[curios-forge-1.19.2-5.1.4.3.jar%23350!/:1.19.2-5.1.4.3]
	at top.theillusivec4.curios.common.event.__CuriosEventHandler_tick_LivingTickEvent.invoke(.dynamic) ~[curios-forge-1.19.2-5.1.4.3.jar%23350!/:1.19.2-5.1.4.3]
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.3.jar%2351!/:?]
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.3.jar%2351!/:?]
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.3.jar%2351!/:?]
	at net.minecraftforge.common.ForgeHooks.onLivingTick(ForgeHooks.java:315) ~[forge-1.19.2-43.3.5-universal.jar%23492!/:?]
	at net.minecraft.world.entity.LivingEntity.m_8119_(LivingEntity.java:2251) ~[server-1.19.2-20220805.130853-srg.jar%23487!/:?]
	at net.minecraft.world.entity.player.Player.m_8119_(Player.java:243) ~[server-1.19.2-20220805.130853-srg.jar%23487!/:?]
	at net.minecraft.server.level.ServerPlayer.m_9240_(ServerPlayer.java:447) ~[server-1.19.2-20220805.130853-srg.jar%23487!/:?]
	... 9 more
[08Dec2023 23:16:36.860] [Server thread/ERROR] [net.minecraftforge.eventbus.EventBus/EVENTBUS]: Exception caught during firing event: Cannot invoke "blusunrize.immersiveengineering.api.wires.localhandlers.EnergyTransferHandler.getSources()" because "energyHandler" is null
	Index: 18
	Listeners:
		0: NORMAL
		1: ASM: io.sr26.creeperconfetti.ConfettiHandler@522621c8 creeperExplodeEvent(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V
		2: ASM: elucent.rootsclassic.event.ComponentSpellsEvent@5ecbfba8 onLivingTick(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V
		3: net.minecraftforge.eventbus.EventBus$$Lambda$1535/0x00007ff684793b30@73f3815f
		4: ASM: wile.engineersdecor.ModEngineersDecor@45b1df6b onPlayerEvent(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V
		5: ASM: vazkii.quark.content.tools.module.PathfinderMapsModule@57d62e6d livingTick(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V
		6: ASM: vazkii.quark.content.tools.module.ParrotEggsModule@4e7c3464 entityUpdate(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V
		7: ASM: vazkii.quark.content.tweaks.module.PoisonPotatoUsageModule@1478c6a8 onEntityUpdate(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V
		8: ASM: vazkii.quark.content.tweaks.module.PigLittersModule@6eaddd8e onEntityUpdate(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V
		9: ASM: vazkii.quark.content.tweaks.module.HorsesSwimModule@2c32ea4e tick(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V
		10: ASM: vazkii.quark.content.tweaks.module.VexesDieWithTheirMastersModule@11366291 checkWhetherAlreadyDead(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V
		11: ASM: vazkii.quark.content.tweaks.module.DragonScalesModule@6bf0e470 onEntityTick(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V
		12: ASM: class com.simibubi.create.foundation.events.CommonEvents onUpdateLivingEntity(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V
		13: ASM: class com.simibubi.create.content.equipment.extendoGrip.ExtendoGripItem holdingExtendoGripIncreasesRange(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V
		14: ASM: class com.simibubi.create.content.equipment.armor.DivingHelmetItem breatheUnderwater(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V
		15: ASM: class com.simibubi.create.content.equipment.armor.DivingBootsItem accellerateDescentUnderwater(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V
		16: ASM: com.mactso.regrowth.events.MoveEntityEvent@64d052fa handleEntityMoveEvents(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V
		17: ASM: squeek.appleskin.network.SyncHandler@7e14978a onLivingTickEvent(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V
		18: ASM: top.theillusivec4.curios.common.event.CuriosEventHandler@6376714e tick(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V
		19: ASM: blusunrize.immersiveengineering.common.EventHandler@70552689 onLivingUpdate(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V
java.lang.NullPointerException: Cannot invoke "blusunrize.immersiveengineering.api.wires.localhandlers.EnergyTransferHandler.getSources()" because "energyHandler" is null
	at TRANSFORMER/[email protected]/blusunrize.immersiveengineering.common.items.PowerpackItem.findBestSource(PowerpackItem.java:265)
	at TRANSFORMER/[email protected]/blusunrize.immersiveengineering.common.items.PowerpackItem.handleAntennaTick(PowerpackItem.java:211)
	at TRANSFORMER/[email protected]/blusunrize.immersiveengineering.common.items.PowerpackItem.onArmorTick(PowerpackItem.java:173)
	at TRANSFORMER/[email protected]/blusunrize.immersiveengineering.common.items.PowerpackItem.m_6883_(PowerpackItem.java:286)
	at TRANSFORMER/[email protected]/net.minecraft.world.item.ItemStack.m_41666_(ItemStack.java:508)
	at TRANSFORMER/[email protected]/top.theillusivec4.curios.common.event.CuriosEventHandler.lambda$tick$25(CuriosEventHandler.java:496)
	at TRANSFORMER/[email protected]/net.minecraftforge.common.util.LazyOptional.ifPresent(LazyOptional.java:150)
	at TRANSFORMER/[email protected]/top.theillusivec4.curios.common.event.CuriosEventHandler.tick(CuriosEventHandler.java:476)
	at TRANSFORMER/[email protected]/top.theillusivec4.curios.common.event.__CuriosEventHandler_tick_LivingTickEvent.invoke(.dynamic)
	at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73)
	at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:315)
	at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:296)
	at TRANSFORMER/[email protected]/net.minecraftforge.common.ForgeHooks.onLivingTick(ForgeHooks.java:315)
	at TRANSFORMER/[email protected]/net.minecraft.world.entity.LivingEntity.m_8119_(LivingEntity.java:2251)
	at TRANSFORMER/[email protected]/net.minecraft.world.entity.player.Player.m_8119_(Player.java:243)
	at TRANSFORMER/[email protected]/net.minecraft.server.level.ServerPlayer.m_9240_(ServerPlayer.java:447)
	at TRANSFORMER/[email protected]/net.minecraft.server.network.ServerGamePacketListenerImpl.m_9933_(ServerGamePacketListenerImpl.java:264)
	at TRANSFORMER/[email protected]/net.minecraft.network.Connection.m_129483_(Connection.java:248)
	at TRANSFORMER/[email protected]/net.minecraft.server.network.ServerConnectionListener.m_9721_(ServerConnectionListener.java:143)
	at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:880)
	at TRANSFORMER/[email protected]/net.minecraft.server.dedicated.DedicatedServer.m_5703_(DedicatedServer.java:292)
	at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:806)
	at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:654)
	at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:244)
	at java.base/java.lang.Thread.run(Thread.java:833)

Steps to reproduce

This bug is very annoying to reproduce, the person with the issue was having many issues trying to get it to happen again.

Issue Logs

Debug: https://gist.github.com/voidsong-dragonfly/d25f957c2a691f27e91f9c25197910a3
Game: https://gist.github.com/voidsong-dragonfly/4ab69437dad3dc934aa867662e22f4ac