Everything posted by mohuang369
-
1.19.4 The client reports an error when receiving the message
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.
-
Help!!!1.19.4 About the issue of channel packet string
Please Help!!!! public static void encode(MessageFromClient msg, FriendlyByteBuf buf) { // buf.writeString(msg.message); LOGGER.info("here:"+msg.message); buf.writeUtf(msg.message); // try { // buf.writeBytes(msg.message.getBytes("utf-8")); // } catch (UnsupportedEncodingException e) { // e.printStackTrace(); // } } I use this method to send string data to the server,this is correct for client side printing {"id":"Manager","formPlug":"Manager","toPlug":"Trmenu","type":3,"playerName":"mohuangNPC","uuid":"85bfd415-4262-352e-ab70-e0f08c077db1","msg":"trmenu open Main"} But what the server receives is: SOH{"id":"Manager","formPlug":"Manager","toPlug":"Trmenu","type":3,"playerName":"mohuangNPC","uuid":"85bfd415-4262-352e-ab70-e0f08c077db1","msg":"trmenu open Main" The prefix is SOH,I searched for information and found that it belongs to ascii,and the symbol is missing at the end "}" This is the server receiving code: public void onPluginMessageReceived(String channel, Player player, byte[] message) { ByteArrayDataInput in = ByteStreams.newDataInput(message); String subchannel = in.readUTF(); Logger.debug(subchannel); String[] split = subchannel.split("\001", -1); if(split.length == 2){ subchannel = split[1]; }else{ subchannel = split[0]; } String[] split1 = subchannel.split("\u0001", -1); if(split1.length == 2){ subchannel = split1[1]; }else{ subchannel = split1[0]; } Logger.debug(subchannel); subchannel = subchannel + "}"; Logger.debug(subchannel); } I now manually remove the prefix and add the suffix,but I want to know what is the reason for this! If anyone knows please help me, I would be very grateful.
-
Help!!!1.19.4 How to configure custom buttons
This is my code : @Mod.EventBusSubscriber(value = Dist.CLIENT) public class KeyBoardInput { public static final KeyMapping BASE_SKILL = new KeyMapping("key.message", KeyConflictContext.IN_GAME, KeyModifier.CONTROL, InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_J, "key.category.neutrino"); @SubscribeEvent public static void onKeyboardInput(InputEvent.Key event) { System.err.println(event.getKey()+":"+event.getAction()); if (BASE_SKILL.consumeClick()) { assert Minecraft.getInstance().player != null; System.out.println("Player"+Minecraft.getInstance().player.getName()+"down"+event.getKey()); }else{ System.out.println("not a rule"); } } } @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public class KeybindingRegistry { @SubscribeEvent public static void onClientSetup(FMLClientSetupEvent event) { ClientRegistry.registerKeyBinding(KeyBoardInput.BASE_SKILL); } } This is my version 1.16 code, and it is successful, but there is no ClientRegistry class in 1.19.4, and I don’t know if there is any problem with other parts. And i did not find a corresponding countermeasure in https://forge.gemwire.uk/wiki/Main_Page
-
How to get the player's information through the player's name in forge development
Thank you so much, I'll try it!But does this method look like it can only be called by the server?
-
How to get the player's information through the player's name in forge development
Thank you so much, I'll try it!But does this method look like it can only be called by the server?
-
How to get the player's information through the player's name in forge development
Hi, In 1.16.2,How to get the player's information through the player's name in forge development?
IPS spam blocked by CleanTalk.