Posted March 23, 201411 yr 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?
March 23, 201411 yr Good on you for trying to do it yourself. I cheated and copied the code from this tutorial. I'm sure you can find some answers in there, though having not built one myself I can't help directly. Good luck! http://i.imgur.com/NdrFdld.png[/img]
March 23, 201411 yr 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.
March 24, 201411 yr 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. -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
March 24, 201411 yr Author Big respect for finding that one sequituri. Fixed and pull request created, hopefully someone can get this in soon. https://github.com/MinecraftForge/FML/pull/398 Apologies if i cocked something up, i rarely use github.
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.