Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

Posted

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!

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.

  • 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.

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.

  • 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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.