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

Im trying to use SimpleNetworkWrapper as it looks like the best way to do the new network stuff, but ive run into a problem.

Im fairly sure im using it correctly but get the following error when trying to register the messages.

 

java.lang.IllegalStateException: cannot determine the type of the type parameter 'REQ': class cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper
at io.netty.util.internal.TypeParameterMatcher.fail(TypeParameterMatcher.java:171)
at io.netty.util.internal.TypeParameterMatcher.find0(TypeParameterMatcher.java:165)
at io.netty.util.internal.TypeParameterMatcher.find(TypeParameterMatcher.java:93)
at io.netty.channel.SimpleChannelInboundHandler.<init>(SimpleChannelInboundHandler.java:60)
at io.netty.channel.SimpleChannelInboundHandler.<init>(SimpleChannelInboundHandler.java:50)
at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.<init>(SimpleChannelHandlerWrapper.java:17)
at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.getHandlerWrapper(SimpleNetworkWrapper.java:85)
at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.addServerHandlerAfter(SimpleNetworkWrapper.java:73)
at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.registerMessage(SimpleNetworkWrapper.java:63)

 

Im creating the wrapper in the init method with the following code.

network = new SimpleNetworkWrapper("MyChannel");
network.registerMessage(PacketHandler.class, Request.class, 1, Side.SERVER);

 

And my handler and messages are as below.

public class PacketHandler implements IMessageHandler<Request, Response>
{
@Override
public Response onMessage(Request message, MessageContext ctx)
{
	...
}
}
public class Request implements IMessage
{
...
}
public class Response implements IMessage
{
...
}

 

Am i missing something?

 

  • Author

Yeah i found SimpleNetworkWrapper by just looking through the docs, and it seemed well, simple.

I guess i could rewrite it to use the method in that tutorial but it seems unnecessarily complex for me when i just want to send 1 packet to the server and get a response.

 

Hopefully someone else has used this and can suggest a solution, otherwise ill just have to rewrite it.

 

Yeah well, the SimpleChannelHandlerWrapper(Class handler, Side side) is bugged, as it never calls super(Class inboundMessageType... ) to get the matcher to cache the class and message type. The default constructor for the superclass relies on the parameter matcher to find it in the cache (which it won't because it was never used before) and fails when it is not there.

 

This should be addressed in bugs & software support.

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.