Issue when triggering animation on block entity over network (in 1.21)
Rearth opened this issue ยท 0 comments
Hi, I'm running into an issue with the "triggerAnim(controllerName, animName)
" function of the GeoBlockEntity.
The crash only happens when playing on dedicated (fabric) servers, in single player / with internal server it works just fine. However when starting a dedicated server and calling the function (from the server side), the player receiving it immediatly disconnects with an error.
The client error is just:
Client disconnected with reason: Internal Exception: io.netty.handler.codec.EncoderException: Failed to encode packet 'clientbound/minecraft:custom_payload' (geckolib:blockentity_anim_trigger)
However in the server logs I get a full exception (albeit without crash):
[18:43:56] [Netty Epoll Server IO #9/ERROR]: Error sending packet clientbound/minecraft:custom_payload
2024-07-10 20:43:56 mc | io.netty.handler.codec.EncoderException: Failed to encode packet 'clientbound/minecraft:custom_payload' (geckolib:blockentity_anim_trigger)
2024-07-10 20:43:56 mc | at net.minecraft.class_9136.handler$zek000$fabric-networking-api-v1$encode(class_9136.java:547) ~[server-intermediary.jar:?]
2024-07-10 20:43:56 mc | at net.minecraft.class_9136.method_56426(class_9136.java:55) ~[server-intermediary.jar:?]
2024-07-10 20:43:56 mc | at net.minecraft.class_9136.encode(class_9136.java:14) ~[server-intermediary.jar:?]
2024-07-10 20:43:56 mc | at net.minecraft.class_2545.method_10838(class_2545.java:26) ~[server-intermediary.jar:?]
2024-07-10 20:43:56 mc | at net.minecraft.class_2545.encode(class_2545.java:12) ~[server-intermediary.jar:?]
2024-07-10 20:43:56 mc | at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107) ~[netty-codec-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:881) ~[netty-transport-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863) ~[netty-transport-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968) ~[netty-transport-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856) ~[netty-transport-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:113) ~[netty-codec-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:881) ~[netty-transport-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863) ~[netty-transport-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968) ~[netty-transport-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856) ~[netty-transport-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.channel.ChannelOutboundHandlerAdapter.write(ChannelOutboundHandlerAdapter.java:113) ~[netty-transport-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at net.minecraft.class_2535$2.write(class_2535.java:530) ~[server-intermediary.jar:?]
2024-07-10 20:43:56 mc | at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:881) ~[netty-transport-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863) ~[netty-transport-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968) ~[netty-transport-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856) ~[netty-transport-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:851) ~[netty-transport-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.channel.DefaultChannelPipeline.write(DefaultChannelPipeline.java:1010) ~[netty-transport-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.channel.AbstractChannel.write(AbstractChannel.java:296) ~[netty-transport-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at net.minecraft.class_2535.method_36942(class_2535.java:350) ~[server-intermediary.jar:?]
2024-07-10 20:43:56 mc | at net.minecraft.class_2535.method_52917(class_2535.java:345) ~[server-intermediary.jar:?]
2024-07-10 20:43:56 mc | at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174) ~[netty-common-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167) ~[netty-common-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470) ~[netty-common-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:413) ~[netty-transport-classes-epoll-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.97.Final.jar:?]
2024-07-10 20:43:56 mc | at java.base/java.lang.Thread.run(Unknown Source) [?:?]
2024-07-10 20:43:56 mc | Caused by: java.lang.ClassCastException: class software.bernie.geckolib.network.packet.BlockEntityAnimTriggerPacket cannot be cast to class net.minecraft.class_8711 (software.bernie.geckolib.network.packet.BlockEntityAnimTriggerPacket and net.minecraft.class_8711 are in unnamed module of loader net.fabricmc.loader.impl.launch.knot.KnotClassLoader @13a57a3b)
2024-07-10 20:43:56 mc | at net.minecraft.class_9139$6.encode(class_9139.java:42) ~[server-intermediary.jar:?]
2024-07-10 20:43:56 mc | at net.minecraft.class_8710$1.method_56489(class_8710.java:52) ~[server-intermediary.jar:?]
2024-07-10 20:43:56 mc | at net.minecraft.class_8710$1.method_56490(class_8710.java:57) ~[server-intermediary.jar:?]
2024-07-10 20:43:56 mc | at net.minecraft.class_8710$1.encode(class_8710.java:39) ~[server-intermediary.jar:?]
2024-07-10 20:43:56 mc | at net.minecraft.class_9139$8.encode(class_9139.java:81) ~[server-intermediary.jar:?]
2024-07-10 20:43:56 mc | at net.minecraft.class_9139$9.method_56442(class_9139.java:97) ~[server-intermediary.jar:?]
2024-07-10 20:43:56 mc | at net.minecraft.class_9139$9.encode(class_9139.java:87) ~[server-intermediary.jar:?]
2024-07-10 20:43:56 mc | at net.minecraft.class_9136.method_56426(class_9136.java:53) ~[server-intermediary.jar:?]
2024-07-10 20:43:56 mc | ... 31 more
2024-07-10 20:43:56 mc | [18:43:56] [Server thread/INFO]: Player490 lost connection: Internal Exception: io.netty.handler.codec.EncoderException: Failed to encode packet 'clientbound/minecraft:custom_payload' (geckolib:blockentity_anim_trigger)
2024-07-10 20:43:56 mc | [18:43:56] [Server thread/INFO]: Player490 left the game
Running on a fabric server with geckolib 1.21:4.5.6, minecraft 1.21, fabric-api 0.100.3+1.21 & fabricloader 0.15.11.
I'm assuming this is an issue with Geckolib, as I can't find anything wrong in the code on my side. For reference, this is where the issue occurs: https://github.com/Rearth/Oritech/blob/v0.7.0/src/main/java/rearth/oritech/block/entity/machines/interaction/TreefellerBlockEntity.java#L114