Posted April 24, 20169 yr I am trying to send a packet to the server, and I am experiencing a crash. http://pastebin.com/6uqpJGCr While researching this crash, all the problems seemed to be from sending a packet to the server, while on the server-side. I am checking the side with worldObj.isRemote on my entity, that the packet is being sent from. FMLCommonHandler#getEffectiveSide() will also have the same outcome as world.isRemote, however FMLCommonHandler#getSide() will have a different output, but using that results in a different error when using sendToAll: http://pastebin.com/vMPK9cUH This is my message sending code in my entity class: if (worldObj.isRemote) { JurassiCraft.NETWORK_WRAPPER.sendToServer(new UpdateAnimationMessage(this)); } else { AnimationHandler.INSTANCE.sendAnimationMessage(this, newAnimation); // This calls sendToAll } You can view sendAnimationMessage here https://github.com/iLexiconn/LLibrary/blob/1.9/src/main/java/net/ilexiconn/llibrary/server/animation/AnimationHandler.java#L30. Thanks in advance.
April 24, 20169 yr Author Do not use getEffectiveSide for mission-critical things. It is meant solely for debugging or quick tests. If you want to check the logical side, you must check World#isRemote . You should not be sending the message to all players. Not every player's client knows about the entity. To get all players, whose client's know about the entity (i.e. the player can see the entity) use WorldServer#getEntityTracker().getTrackingPlayers . Why is there a client-to-server message at all? That sounds like a horrible idea, the client should not have any say in this. Oh, yeah, I should probably not send it from the client. Not sure why I thought of doing it like that. I was only using getEffectiveSide for debugging, I'm not using it for this. I'm also having the same crash, however, for a different packet. It is being sent to the server from inside my GUI class, so it definitely is on the client-side. Thanks.
April 24, 20169 yr Author Where is this? https://github.com/TimelessModdingTeam/JurassiCraft2/blob/master/src/main/java/org/jurassicraft/client/gui/SelectDinoGui.java#L158
April 24, 20169 yr Author So, now I have to learn how that stupid @NetworkWrapper annotation works... Apart from the implementation being horrid (why in gods name are you classtransforming FML... please stop...), you just register every message blindly for client & server. With different IDs for each. This is designed to blow up. Sorry about that. Would there be another way be to detect those annotations? Also, I got it wrong. The crash is different. (Sorry D:) This is the crash http://pastebin.com/f4fFfvH1
April 24, 20169 yr Author Sorry about that. Would there be another way be to detect those annotations?Handle FMLConstructionEvent in the ModContainer for the coremod part of the library. It provides you with the ASMDataTable. Also, I got it wrong. The crash is different. (Sorry D:) This is the crash http://pastebin.com/f4fFfvH1 How did you think that crash was related to your packets? Put a breakpoint in the erroring method and check what is null there. Okay, thanks! I'll have a go at it.
April 24, 20169 yr Author Put a breakpoint in the erroring method and check what is null there. Looks like the MinecraftServer instance is null (FMLCommonHandler#getWorldThread), and sidedDelegate is an instance of FMLServerHandler but the net handler is client-side.
April 24, 20169 yr Author That should not be happening... Put a breakpoint in the FMLServerHandler constructor and see from where it is called (post that call trace). http://i.imgur.com/XbxQSfH.png Is there something wrong with https://github.com/iLexiconn/LLibrary/blob/1.9/src/main/java/net/ilexiconn/llibrary/server/ServerProxy.java#L35 ?
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.