Jump to content

[1.9] Synchornizing Configuration: net dispatching thread not yet started?


Elix_x

Recommended Posts

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.