DanielRuns Posted February 25, 2013 Share Posted February 25, 2013 My packets are not sending properly from client to server -- they are staying on the client side. I checked the packet handler with World.isRemote, and it was always called on the client side. If you could help that'd be great. Packet class: http://pastebin.com/suiV6Xx5 Packet handler Class: http://pastebin.com/Wn3YnuRV Quote Link to comment Share on other sites More sharing options...
mnn Posted February 25, 2013 Share Posted February 25, 2013 Just to be sure, when isRemote is true then the code is running on the client. I'm writing it, because in your code you're sending packet client -> server. But in the incoming packet code is: if(!world.isRemote){ PacketDispatcher.sendPacketToServer(packet); } ~ On a server side if it is a server side you resend same packet to a server? I compared it to mine packet handling and I can't see anything bad (I'm using getEffectiveSide but world object should carry same information). You can take a look (it's functional code): https://github.com/mnn/jaffas/blob/b6b35d87e3a00b2fa36baf297569982a38fd5250/src/minecraft/monnef/jaffas/food/common/SpawnStonePacketUtils.java https://github.com/mnn/jaffas/blob/b6b35d87e3a00b2fa36baf297569982a38fd5250/src/minecraft/monnef/jaffas/food/common/PacketHandler.java Quote mnn.getNativeLang() != English If I helped you please click on the "thank you" button. Link to comment Share on other sites More sharing options...
DanielRuns Posted February 26, 2013 Author Share Posted February 26, 2013 When I added that code to the packet handler it created an infinite loop, which resulted in a stack overflow. Quote Link to comment Share on other sites More sharing options...
mnn Posted February 26, 2013 Share Posted February 26, 2013 That code snippet is from your packet handler. If you're talking about my code than you're doing something wrong. My handler uses 2 types of packets and each type is strictly either client->server or server->client, so it's not possible to loop infinitely (one is request for update from client, second is update packet for client. on a second one client does not respond, so there can't be a loop). Quote mnn.getNativeLang() != English If I helped you please click on the "thank you" button. Link to comment Share on other sites More sharing options...
DanielRuns Posted February 27, 2013 Author Share Posted February 27, 2013 Okay, thanks. I got it working. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.