Jump to content

1.19.4 The client reports an error when receiving the message


mohuang369

Recommended Posts

java.lang.IndexOutOfBoundsException: index: 3, length: 15747 (expected: range(0, 133))
	at io.netty.buffer.AbstractByteBuf.checkRangeBounds(AbstractByteBuf.java:1390) ~[netty-buffer-4.1.82.Final.jar%23117!/:4.1.82.Final]
	at io.netty.buffer.AbstractByteBuf.checkIndex0(AbstractByteBuf.java:1397) ~[netty-buffer-4.1.82.Final.jar%23117!/:4.1.82.Final]
	at io.netty.buffer.AbstractByteBuf.checkIndex(AbstractByteBuf.java:1384) ~[netty-buffer-4.1.82.Final.jar%23117!/:4.1.82.Final]
	at io.netty.buffer.UnsafeByteBufUtil.getBytes(UnsafeByteBufUtil.java:481) ~[netty-buffer-4.1.82.Final.jar%23117!/:4.1.82.Final]
	at io.netty.buffer.PooledUnsafeDirectByteBuf.getBytes(PooledUnsafeDirectByteBuf.java:130) ~[netty-buffer-4.1.82.Final.jar%23117!/:4.1.82.Final]
	at io.netty.buffer.ByteBufUtil.decodeString(ByteBufUtil.java:1270) ~[netty-buffer-4.1.82.Final.jar%23117!/:4.1.82.Final]
	at io.netty.buffer.AbstractByteBuf.toString(AbstractByteBuf.java:1246) ~[netty-buffer-4.1.82.Final.jar%23117!/:4.1.82.Final]
	at net.minecraft.network.FriendlyByteBuf.toString(FriendlyByteBuf.java:1537) ~[client-1.19.4-20230314.122934-srg.jar%23156!/:?]
	at net.minecraft.network.FriendlyByteBuf.m_130136_(FriendlyByteBuf.java:676) ~[client-1.19.4-20230314.122934-srg.jar%23156!/:?]
	at net.minecraft.network.FriendlyByteBuf.m_130277_(FriendlyByteBuf.java:665) ~[client-1.19.4-20230314.122934-srg.jar%23156!/:?]
	at com.edrik.edrikmanager.message.MessageFromClient.decode(MessageFromClient.java:62) ~[modid-1.0.jar%23154!/:1.0]
	at net.minecraftforge.network.simple.IndexedMessageCodec.lambda$tryDecode$0(IndexedMessageCodec.java:107) ~[forge-1.19.4-45.1.16-universal.jar%23161!/:?]
	at java.util.Optional.map(Optional.java:260) ~[?:?]
	at net.minecraftforge.network.simple.IndexedMessageCodec.tryDecode(IndexedMessageCodec.java:107) ~[forge-1.19.4-45.1.16-universal.jar%23161!/:?]
	at net.minecraftforge.network.simple.IndexedMessageCodec.consume(IndexedMessageCodec.java:153) ~[forge-1.19.4-45.1.16-universal.jar%23161!/:?]
	at net.minecraftforge.network.simple.SimpleChannel.networkEventListener(SimpleChannel.java:63) ~[forge-1.19.4-45.1.16-universal.jar%23161!/:?]
	at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:260) ~[eventbus-6.0.3.jar%2385!/:?]
	at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:252) ~[eventbus-6.0.3.jar%2385!/:?]
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.3.jar%2385!/:?]
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.3.jar%2385!/:?]
	at net.minecraftforge.network.NetworkInstance.dispatch(NetworkInstance.java:68) ~[forge-1.19.4-45.1.16-universal.jar%23161!/:?]
	at net.minecraftforge.network.NetworkHooks.lambda$onCustomPayload$1(NetworkHooks.java:80) ~[forge-1.19.4-45.1.16-universal.jar%23161!/:?]
	at java.util.Optional.map(Optional.java:260) ~[?:?]
	at net.minecraftforge.network.NetworkHooks.onCustomPayload(NetworkHooks.java:80) ~[forge-1.19.4-45.1.16-universal.jar%23161!/:?]
	at net.minecraft.client.multiplayer.ClientPacketListener.m_7413_(ClientPacketListener.java:1834) ~[client-1.19.4-20230314.122934-srg.jar%23156!/:?]
	at net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket.m_5797_(ClientboundCustomPayloadPacket.java:57) ~[client-1.19.4-20230314.122934-srg.jar%23156!/:?]
	at net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket.m_5797_(ClientboundCustomPayloadPacket.java:7) ~[client-1.19.4-20230314.122934-srg.jar%23156!/:?]
	at net.minecraft.network.Connection.m_129517_(Connection.java:166) ~[client-1.19.4-20230314.122934-srg.jar%23156!/:?]
	at net.minecraft.network.Connection.channelRead0(Connection.java:151) ~[client-1.19.4-20230314.122934-srg.jar%23156!/:?]
	at net.minecraft.network.Connection.channelRead0(Connection.java:50) ~[client-1.19.4-20230314.122934-srg.jar%23156!/:?]
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) ~[netty-codec-4.1.82.Final.jar%23118!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:336) ~[netty-codec-4.1.82.Final.jar%23118!/:4.1.82.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:308) ~[netty-codec-4.1.82.Final.jar%23118!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:336) ~[netty-codec-4.1.82.Final.jar%23118!/:4.1.82.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:308) ~[netty-codec-4.1.82.Final.jar%23118!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:336) ~[netty-codec-4.1.82.Final.jar%23118!/:4.1.82.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:308) ~[netty-codec-4.1.82.Final.jar%23118!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) ~[netty-handler-4.1.82.Final.jar%23120!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) ~[netty-transport-4.1.82.Final.jar%23124!/:4.1.82.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.82.Final.jar%23119!/:4.1.82.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.82.Final.jar%23119!/:4.1.82.Final]
 public static MessageFromClient decode(FriendlyByteBuf buf) {
        String res = null;
        try {
            res = buf.readUtf();
        } catch (Exception e) {
            LOGGER.error("error",e);
        }
        LOGGER.info(res);
        return new MessageFromClient(res);
    }

This is my code and error. I'm sorry. I really can't find the problem.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.