Easy NPC

Easy NPC

2M Downloads

[Bug] "Cannot send packets when not in game"

Immorikal opened this issue ยท 1 comments

commented

๐Ÿ’ก Check the
Bug Tracker
and Crash Tracker before
reporting a new issue.
There you can find a lot of useful information and solutions for common problems.

Note:
Please make sure to fill out the following template to the best of your ability. This will help us
to identify and fix the issue faster.

Minecraft and Mod version ๐Ÿž
The used Minecraft and Mod version.
1.20.1 - EasyNPC v5.58 - Fabric Version (Loader: 0.16.2)

Describe the bug ๐Ÿž
A clear and concise description of what the bug is.

  • This is better explained in the 'reproduce' area, but I cannot rejoin my Singleplayer world, currently.

To Reproduce โš™๏ธ
Steps to reproduce the behavior:

  • I cannot perfectly reproduce this. However, the behavior is usually as follows. Upon creating several new NPCs, and implementing 'battle systems' via Cobblemon to them (using CobblemonTrainers), and just various different dialogue, it'll all work perfectly fine up until some point. Where it'll eventually just lock me out, as it has now. For this latest version with CobblemonTrainers mainly (this happened before this, too), I was just setting up a new trainer's Cobblemons, levels, etc. When it just crashed on me. Upon reboot, that's when I faced the error below.

Expected behavior โœ”๏ธ
A clear and concise description of what you expected to happen.

Screenshots ๐Ÿ“ธ
If applicable, add screenshots to help explain your problem.

Debugging ๐Ÿ› ๏ธ
Before reporting an issue, please enable the debug mode over /easy_npc debug true to get more
detailed information about the issue in the logs.
Additionally, check if there is anything relevant in the crash-reports, debug.log, and latest.log
file.

Log Snippet taken directly from my Prism Launcher console:
[05:15:42] [Netty Local Client IO #1/ERROR]: Exception occurred in netty pipeline
java.lang.IllegalStateException: Cannot send packets when not in game!
at net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking.send(ClientPlayNetworking.java:370) ~[fabric-networking-api-v1-1.3.11+1802ada577-a65c3ef3908d32fd.jar:?]
at de.markusbordihn.easynpc.network.NetworkHandler.sendToServer(NetworkHandler.java:50) ~[easy_npc-fabric-1.20.1-5.5.8.jar:?]
at de.markusbordihn.easynpc.network.NetworkHandlerManager.sendToServer(NetworkHandlerManager.java:94) ~[easy_npc-fabric-1.20.1-5.5.8.jar:?]
at de.markusbordihn.easynpc.network.message.ServerNetworkMessageHandlerInterface.openMenu(ServerNetworkMessageHandlerInterface.java:310) ~[easy_npc-fabric-1.20.1-5.5.8.jar:?]
at de.markusbordihn.easynpc.network.message.client.OpenMenuCallbackMessage.handleClient(OpenMenuCallbackMessage.java:82) ~[easy_npc-fabric-1.20.1-5.5.8.jar:?]
at de.markusbordihn.easynpc.network.NetworkHandler.lambda$registerClientNetworkMessageHandler$0(NetworkHandler.java:76) ~[easy_npc-fabric-1.20.1-5.5.8.jar:?]
at net.fabricmc.fabric.impl.networking.client.ClientPlayNetworkAddon.receive(ClientPlayNetworkAddon.java:98) ~[fabric-networking-api-v1-1.3.11+1802ada577-a65c3ef3908d32fd.jar:?]
at net.fabricmc.fabric.impl.networking.client.ClientPlayNetworkAddon.receive(ClientPlayNetworkAddon.java:40) ~[fabric-networking-api-v1-1.3.11+1802ada577-a65c3ef3908d32fd.jar:?]
at net.fabricmc.fabric.impl.networking.AbstractChanneledNetworkAddon.handle(AbstractChanneledNetworkAddon.java:101) ~[fabric-networking-api-v1-1.3.11+1802ada577-a65c3ef3908d32fd.jar:?]
at net.fabricmc.fabric.impl.networking.client.ClientPlayNetworkAddon.handle(ClientPlayNetworkAddon.java:90) ~[fabric-networking-api-v1-1.3.11+1802ada577-a65c3ef3908d32fd.jar:?]
at net.minecraft.class_634.handler$fbm000$fabric-networking-api-v1$handleCustomPayload(class_634.java:4268) ~[client-intermediary.jar:?]
at net.minecraft.class_634.method_11152(class_634.java) ~[client-intermediary.jar:?]
at net.minecraft.class_2658.method_11457(class_2658.java:60) ~[client-intermediary.jar:?]
at net.minecraft.class_2658.method_11054(class_2658.java:8) ~[client-intermediary.jar:?]
at net.minecraft.class_2535.method_10759(class_2535.java:175) ~[client-intermediary.jar:?]
at net.minecraft.class_2535.method_10770(class_2535.java:160) ~[client-intermediary.jar:?]
at net.minecraft.class_2535.channelRead0(class_2535.java:52) ~[client-intermediary.jar:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.local.LocalChannel.readInbound(LocalChannel.java:299) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.local.LocalChannel.finishPeerRead0(LocalChannel.java:445) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.local.LocalChannel.access$400(LocalChannel.java:50) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.local.LocalChannel$5.run(LocalChannel.java:403) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174) ~[netty-common-4.1.82.Final.jar:?]
at io.netty.channel.DefaultEventLoop.run(DefaultEventLoop.java:54) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.82.Final.jar:?]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.82.Final.jar:?]
at java.lang.Thread.run(Thread.java:842) ~[?:?]

Is the issue happening in combination with other mods? (If yes, please provide a full list) ๐Ÿงฉ

List: https://pastebin.com/8pV6LLLn

Additional context ๐Ÿ“
Add any other context about the problem here.

  • Not sure what else to mention here! But I feel like this happens when you start to add a lot of NPCs to the world.
commented

Thank you for the report. I've added a safety check that should prevent this error after a crash.

The issue occurs because the client attempts to send a package that is still queued during game startup, leading to this error message and an additional crash.

In version 5.5.9, we've implemented double-checks to ensure the connection is still valid, which should prevent the client from crashing if any errors occur.

Please let me know if this resolves the issue. Thanks!