Posted August 17, 201411 yr I setup my SimpleNetworkWrapper in my preInit method of my base mode class. This works fine for dedicated servers and single player, but when my mods runs as a client in multiplayer, it crashes. How can I prevent my mod from setting up the SimpleNetworkWrapper when it is run as a client on multiplayer. I already tried Minecraft.getMinecraft.isSinglePlayer() to detect if my mod is running on an integrated server, but it always returns false.
August 17, 201411 yr I think you want to set up a proxy. Perhaps this thread could help I like trains.
August 17, 201411 yr Author I fixed the issue for single player by making a global variable that the integrated server can set directly, nullifying the need for packets. Now my SimpleNetworkWrapper isn't working on multiplayer. I set it up in my server's preInit method with net = NetworkRegistry.INSTANCE.newSimpleChannel("dataChannel"); net.registerMessage(PacketHandler.class, Packet.class, 0, Side.CLIENT); and send it with net.sendTo(new Packet(data), player); I tested this code on single player without the global variable and it worked, but on multiplayer the client doesn't receive the packet.
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.