AtomicStryker / atomicstrykers-minecraft-mods

Repository for my open source Minecraft Mods
https://atomicstryker.github.io/
181 stars 97 forks source link

A Custom Payload error occurs. #516

Closed KayaIvanova closed 1 month ago

KayaIvanova commented 3 months ago

Dear AtomicStryker, I was playing with my friends yesterday with the ATM10 v0.38 modpack and added this mod, and this error occurred and I was returned to the multiplayer lobby.

Below is the error message that is output in the console window.

[09:35:13] [Netty Server IO #6/ERROR] [minecraft/Connection]: Exception caught in connection io.netty.handler.codec.EncoderException: Failed to encode packet 'clientbound/minecraft:custom_payload' at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.codec.IdDispatchCodec.encode(IdDispatchCodec.java:55) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading} at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.codec.IdDispatchCodec.encode(IdDispatchCodec.java:14) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading} at TRANSFORMER/neoforge@21.1.23/net.neoforged.neoforge.network.filters.GenericPacketSplitter.encode(GenericPacketSplitter.java:104) ~[neoforge-21.1.23-universal.jar%23352!/:?] {re:classloading} at TRANSFORMER/neoforge@21.1.23/net.neoforged.neoforge.network.filters.GenericPacketSplitter.encode(GenericPacketSplitter.java:39) ~[neoforge-21.1.23-universal.jar%23352!/:?] {re:classloading} at MC-BOOTSTRAP/io.netty.codec@4.1.97.Final/io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:90) ~[netty-codec-4.1.97.Final.jar%23104!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.transport@4.1.97.Final/io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:881) ~[netty-transport-4.1.97.Final.jar%23108!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.transport@4.1.97.Final/io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863) ~[netty-transport-4.1.97.Final.jar%23108!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.transport@4.1.97.Final/io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968) ~[netty-transport-4.1.97.Final.jar%23108!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.transport@4.1.97.Final/io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856) ~[netty-transport-4.1.97.Final.jar%23108!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.codec@4.1.97.Final/io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:113) ~[netty-codec-4.1.97.Final.jar%23104!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.transport@4.1.97.Final/io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:881) ~[netty-transport-4.1.97.Final.jar%23108!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.transport@4.1.97.Final/io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863) ~[netty-transport-4.1.97.Final.jar%23108!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.transport@4.1.97.Final/io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968) ~[netty-transport-4.1.97.Final.jar%23108!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.transport@4.1.97.Final/io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856) ~[netty-transport-4.1.97.Final.jar%23108!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.transport@4.1.97.Final/io.netty.channel.ChannelOutboundHandlerAdapter.write(ChannelOutboundHandlerAdapter.java:113) ~[netty-transport-4.1.97.Final.jar%23108!/:4.1.97.Final] {} at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.Connection$2.write(Connection.java:528) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading} at MC-BOOTSTRAP/io.netty.transport@4.1.97.Final/io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:881) ~[netty-transport-4.1.97.Final.jar%23108!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.transport@4.1.97.Final/io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863) ~[netty-transport-4.1.97.Final.jar%23108!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.transport@4.1.97.Final/io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968) ~[netty-transport-4.1.97.Final.jar%23108!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.transport@4.1.97.Final/io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856) ~[netty-transport-4.1.97.Final.jar%23108!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.transport@4.1.97.Final/io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:851) ~[netty-transport-4.1.97.Final.jar%23108!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.transport@4.1.97.Final/io.netty.channel.DefaultChannelPipeline.write(DefaultChannelPipeline.java:1010) ~[netty-transport-4.1.97.Final.jar%23108!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.transport@4.1.97.Final/io.netty.channel.AbstractChannel.write(AbstractChannel.java:296) ~[netty-transport-4.1.97.Final.jar%23108!/:4.1.97.Final] {} at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.Connection.doSendPacket(Connection.java:364) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading,re:mixin} at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.Connection.lambda$sendPacket$12(Connection.java:359) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading,re:mixin} at MC-BOOTSTRAP/io.netty.common@4.1.97.Final/io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174) ~[netty-common-4.1.97.Final.jar%23105!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.common@4.1.97.Final/io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167) ~[netty-common-4.1.97.Final.jar%23105!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.common@4.1.97.Final/io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470) ~[netty-common-4.1.97.Final.jar%23105!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.transport@4.1.97.Final/io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569) ~[netty-transport-4.1.97.Final.jar%23108!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.common@4.1.97.Final/io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.97.Final.jar%23105!/:4.1.97.Final] {} at MC-BOOTSTRAP/io.netty.common@4.1.97.Final/io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.97.Final.jar%23105!/:4.1.97.Final] {} at java.base/java.lang.Thread.run(Thread.java:1583) [?:?] {re:mixin} Caused by: java.lang.RuntimeException: Failed encoding custom payload infernalmobs:velocity: java.lang.ClassCastException: class atomicstryker.infernalmobs.common.network.VelocityPacket cannot be cast to class net.minecraft.network.protocol.common.custom.DiscardedPayload (atomicstryker.infernalmobs.common.network.VelocityPacket is in module infernalmobs@1.21.3NF of loader 'TRANSFORMER' @307af381; net.minecraft.network.protocol.common.custom.DiscardedPayload is in module minecraft@1.21.1 of loader 'TRANSFORMER' @307af381) at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.protocol.common.custom.CustomPacketPayload$1.writeCap(CustomPacketPayload.java:42) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading} at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.protocol.common.custom.CustomPacketPayload$1.encode(CustomPacketPayload.java:47) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading} at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.protocol.common.custom.CustomPacketPayload$1.encode(CustomPacketPayload.java:29) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading} at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.codec.StreamCodec$4.encode(StreamCodec.java:81) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading} at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.codec.StreamCodec$5.encode(StreamCodec.java:97) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading} at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.codec.StreamCodec$5.encode(StreamCodec.java:87) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading} at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.codec.IdDispatchCodec.encode(IdDispatchCodec.java:53) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading} ... 31 more Caused by: java.lang.ClassCastException: class atomicstryker.infernalmobs.common.network.VelocityPacket cannot be cast to class net.minecraft.network.protocol.common.custom.DiscardedPayload (atomicstryker.infernalmobs.common.network.VelocityPacket is in module infernalmobs@1.21.3NF of loader 'TRANSFORMER' @307af381; net.minecraft.network.protocol.common.custom.DiscardedPayload is in module minecraft@1.21.1 of loader 'TRANSFORMER' @307af381) at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.codec.StreamCodec$2.encode(StreamCodec.java:42) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading} at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.protocol.common.custom.CustomPacketPayload$1.writeCap(CustomPacketPayload.java:40) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading} at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.protocol.common.custom.CustomPacketPayload$1.encode(CustomPacketPayload.java:47) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading} at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.protocol.common.custom.CustomPacketPayload$1.encode(CustomPacketPayload.java:29) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading} at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.codec.StreamCodec$4.encode(StreamCodec.java:81) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading} at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.codec.StreamCodec$5.encode(StreamCodec.java:97) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading} at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.codec.StreamCodec$5.encode(StreamCodec.java:87) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading} at TRANSFORMER/minecraft@1.21.1/net.minecraft.network.codec.IdDispatchCodec.encode(IdDispatchCodec.java:53) ~[server-1.21.1-20240808.144430-srg.jar%23351!/:?] {re:classloading} ... 31 more [09:35:13] [Server thread/INFO] [minecraft/ServerGamePacketListenerImpl]: Nickname lost connection: Internal Exception: io.netty.handler.codec.EncoderException: Failed to encode packet 'clientbound/minecraft:custom_payload' [09:35:13] [Server thread/INFO] [minecraft/MinecraftServer]: Nickname left the game

I am not familiar with English, so I wrote this using Google Translate, so the sentences may be awkward. Minecraft__NeoForge_Loading _2024-08-24_9_35_19

AtomicStryker commented 3 months ago

The relevant error is this:

Caused by: java.lang.RuntimeException: Failed encoding custom payload infernalmobs:velocity: java.lang.ClassCastException: class atomicstryker.infernalmobs.common.network.VelocityPacket cannot be cast to class net.minecraft.network.protocol.common.custom.DiscardedPayload

It looks like one side wants to throw Infernal Mobs packets away, but fails in doing so. Did the server and the client both have the mod installed?

KayaIvanova commented 3 months ago

Yes, it's installed on the server and all clients. I've had this happen when I'm out and about with friends and encounter mobs in that mode or engage in combat, and strangely enough, none of the people I'm with have had the error at the same time.

AtomicStryker commented 3 months ago

So the mod generally works, but sometimes crashes you out with this exact message?

Well, the only modifier using it is MM_BlastOff. So you can configure that disabled, i guess.

Otherwise i have no clue and you are probably better off asking the NeoForge people.

KayaIvanova commented 3 months ago

Thank you for your reply. I will apply it as you said and let you know the results.

KayaIvanova commented 3 months ago

After checking, it was confirmed that not only MM_BlastOff but also MM_Gravity was problematic.

I disabled MM_BlastOff and played, encountered a mob with a gravity effect, and when I fought it, I saw the same error occur. When I excluded that too, the error did not occur.

In conclusion, it seems that there is a problem with the effect that forcibly moves the player's location.

AtomicStryker commented 3 months ago

MM_Gravity uses KnockBackPacket, which which you correctly identify as one that makes a player move. Still does not explain why NeoForge would "discard" these.

AtomicStryker commented 1 month ago

Duplicate of https://github.com/AtomicStryker/atomicstrykers-minecraft-mods/issues/523, closing this one, should be solved now