Posted May 10, 20169 yr Hello everybody! I want to sync configs of my mod: when client connects, send him config and then he recieves and reads it. My config contains things, that if they are different on client and server, may crash mc. So i tried using LinkedBlockingQueue to block until configuration is recieved. But apparently, when WorldEvent.Load is fired on client side (last point where i must load from server's config), net thread is not yet started and message is not received and processed. So client just stops. How can i go about this? What should i do to sync configs between server and clients if they contain so important things? Thanks for help! If you have any questions - just ask! Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
May 10, 20169 yr Crashing caused by not having config is a bad design. You should have deafults setup (or fake objects if needed). ServerConnectionFromClientEven is best way to send configs to client before EntityPlayer is even constructed. Event is fired before everything. If you config needs world or player or anything (which aren't present at that point) - it is sign of bad design. 1.7.10 is no longer supported by forge, you are on your own.
May 10, 20169 yr Author Crashing caused by not having config is a bad design. You should have deafults setup (or fake objects if needed). Well, it won't crash, but weird things will happen and bugs appear. ServerConnectionFromClientEven is best way to send configs to client before EntityPlayer is even constructed. Event is fired before everything. If you config needs world or player or anything (which aren't present at that point) - it is sign of bad design. Problem here is that message is written to bytebuf and sent, but is not received by client who is waiting for it. Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
May 10, 20169 yr If you are sure about it (are you using thread safety?), it might be that, like you said, packeting hasn't started yet (because ServerConnectionFromClientEvent is one of 1st things that happen). I personally don't use it, I jut proposed it as an option. You can safely use PlayerLoggedInEvent (I use it). Very good for syncing configs. PlayerLoggedInEvent happens before everything important, so if you designed your stuff properly, it should work. If not - try to redesign it to fit logic flow (seriously, glitches caused by configuration is like super bad thing, config should never be able to do bad things in my opinion, you should take care of it). 1.7.10 is no longer supported by forge, you are on your own.
May 11, 20169 yr Author If you are sure about it (are you using thread safety?), it might be that, like you said, packeting hasn't started yet (because ServerConnectionFromClientEvent is one of 1st things that happen). I personally don't use it, I jut proposed it as an option. You can safely use PlayerLoggedInEvent (I use it). Very good for syncing configs. PlayerLoggedInEvent happens before everything important, so if you designed your stuff properly, it should work. If not - try to redesign it to fit logic flow (seriously, glitches caused by configuration is like super bad thing, config should never be able to do bad things in my opinion, you should take care of it). I neither use ServerConnectionFromClientEvent. I am using PlayerLoggedInEvent and i added sysouts to the log. Following them, message is: given to net thread and sent, but never recieved and processed (given - net.send, sent - writeToByteBuf, receive - readFromByteBuf, process - handler.process). If i won't be able to do something about it, well i guess no auto syncing configuration... Also, it won't crash mc, but i will have hard times cleaning up incorrectly loaded things. Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
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.