Jump to content

[1.12.2] Need advice to find the right event (Client Disconnection) [SOLVED]


moonlyer

Recommended Posts

Hi,

I'm trying to make a global world winter. Basically I change biome values in the registries using reflection to make it snow everywhere. I've almost made it work as intended.

But there's one issue: If I quit the world during winter (when biome values are changed), and create a new world - then new world will be generated with snow everywhere (cause I never changed back the registry values).

I've fixed this issue in singleplayer scenario by subscribing to onServerStopping event and restoring default registry values there, but when dealing with the dedicated server idk to what event I should subscribe.

I've tried onPlayerLoggedOut event, but it never runs on the client side, and packets from server do not reach client (cause the player already logged out).

I was thinking about onWorldUnload - but it seems that this event can fire during the game (when dimensions switches), and idk how to determine if the world unloads "for the last time".

 

Is there an event for me to subscribe to? 

Edited by moonlyer
Link to comment
Share on other sites

6 minutes ago, moonlyer said:

Is there an event for me to subscribe to? 

FMLNetworkEvent.ClientDisconnectionFromServerEvent

  • Like 1

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Or save the data to the world. ..

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

8 minutes ago, Draco18s said:

Or save the data to the world. ..

I do save data to the world and i change registry values on world startup if data differs from default state. I just undo this changes every time client disconnects. It is probably unnecessary, but I feel comfortable to know that when no world is loaded - the registries have default values.

 

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.

Announcements



×
×
  • Create New...

Important Information

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