Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hey,

I've got a Problem with handling packets. I try to send a packet wich contains some Information to the server whos going to send it to all Players. Like a broadcast packet. It's working fine in eclipse but when I compile the mod and put it in my mods Folder it's not working anymore. It seems that the packet was sent to the wrong PacketHandler.

Here is the code of the packet Registration:

 

 

public void init(FMLInitializationEvent e) {
    	snWrapper = NetworkRegistry.INSTANCE.newSimpleChannel("RetroChannel");
	snWrapper.registerMessage(PacketSyncMessageHandler.class, PacketSyncDataClient.class, 0, Side.CLIENT);
	snWrapper.registerMessage(PacketSyncRequestMessageHandler.class, PacketSyncRequest.class, 1, Side.SERVER);
	snWrapper.registerMessage(PacketSyncDataHandler.class, PacketSyncDataServer.class, 2, Side.SERVER);


	snWrapper.registerMessage(PacketModelToggleClientHandler.class, PacketModelToggle.class, 3, Side.CLIENT);
	snWrapper.registerMessage(PacketModelToggleServerHandler.class, PacketModelToggle.class, 4, Side.SERVER);

	EventHandler handler = new EventHandler();
    	MinecraftForge.EVENT_BUS.register(handler);
    	FMLCommonHandler.instance().bus().register(handler);

    	NetworkRegistry.INSTANCE.registerGuiHandler(RetroProjectContainer.instance, new GuiHandler());
    }

 

The method is called throug a common Proxy.

Here is my exception:

 

[16:11:14] [Netty Client IO #1/ERROR] [FML]: There was a critical exception handling a packet on channel RetroChannel
io.netty.handler.codec.DecoderException: java.lang.RuntimeException: java.io.EOFException: fieldSize is too long! Length is 12601, but maximum is 0
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:4.0.15.Final]
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) ~[DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) ~[DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) ~[DefaultChannelPipeline.class:4.0.15.Final]
at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:4.0.15.Final]
at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.func_148833_a(FMLProxyPacket.java:79) [FMLProxyPacket.class:?]
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:136) [gr.class:?]
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:414) [gr.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [simpleChannelInboundHandler.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleClientSideCustomPacket(NetworkDispatcher.java:379) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:246) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:50) [NetworkDispatcher.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [simpleChannelInboundHandler.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:153) [byteToMessageDecoder.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:153) [byteToMessageDecoder.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:153) [byteToMessageDecoder.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHandler.java:149) [ReadTimeoutHandler.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:4.0.15.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:132) [AbstractNioByteChannel$NioByteUnsafe.class:4.0.15.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:485) [NioEventLoop.class:4.0.15.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:452) [NioEventLoop.class:4.0.15.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:346) [NioEventLoop.class:4.0.15.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [singleThreadEventExecutor$2.class:4.0.15.Final]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_25]
Caused by: java.lang.RuntimeException: java.io.EOFException: fieldSize is too long! Length is 12601, but maximum is 0
at com.google.common.base.Throwables.propagate(Throwables.java:160) ~[guava-17.0.jar:?]
at net.minecraftforge.fml.common.network.ByteBufUtils.readItemStack(ByteBufUtils.java:165) ~[byteBufUtils.class:?]
at de.wolfi.retroproject.client.network.packets.PacketSyncDataClient.fromBytes(PacketSyncDataClient.java:25) ~[PacketSyncDataClient.class:?]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:17) ~[simpleIndexedCodec.class:?]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:7) ~[simpleIndexedCodec.class:?]
at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:81) ~[FMLIndexedMessageToMessageCodec.class:?]
at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:21) ~[FMLIndexedMessageToMessageCodec.class:?]
at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:4.0.15.Final]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:4.0.15.Final]
... 36 more

 

As you can see, it was converted to the wrong Packet.

I don't know what went wrong. Maby because I've registered it twice?

 

Please don't kill me for my grammer :3

 

 

 

...There is no reference of a PacketHandler in the crash report, i have no idea how you thought that was the problem. Post your PacketSyncDataClient class.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Author

The PacketSyncData class should not be called! I'm sending the ModelTogglePacket so why was it converted to a PacketSyncData ?

The PacketSyncData class should not be called! I'm sending the ModelTogglePacket so why was it converted to a PacketSyncData ?

...Obviously it is being called because it is erroring on line 25. And try removing any calls to send the packet. Make sure that you check if you are sending the correct packet. Does ModelTogglePacket extend PacketSyncData?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Author

The exception is thrown because it trying to read a PacketSyncData out of a ModelTogglePacket. ModelTogglePacket implements IMessage as it should.

 

Here is the code where the Packet gets send:

   protected void actionPerformed(GuiButton button)
    {
        if (button.enabled)
        {
        	System.out.println(Cosmetics.values()[button.id]+ " toggled");
           RetroProjectContainer.snWrapper.sendToServer(new PacketModelToggle(Minecraft.getMinecraft().thePlayer.getName(), button.id));
        }
    }

And here is the code for the ServerSide MessageHandler

@Override
public IMessage onMessage(PacketModelToggle message, MessageContext ctx) {
	PacketModelToggleServerHandler.toggle(message.getCosmeticIndex(), message.getPlayer());
	RetroProjectContainer.snWrapper.sendToAll(message);
	return null;
}

It's strange...

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.