Posted May 21, 20205 yr Assume a player creates a new world. After the world has done its initial generation, either right before the player joins the world or right after, I want to execute my arbitrary code. Let's say print "Hello World" once to the console. How would I go about doing this? Client side only, don't care about server.
May 21, 20205 yr Author My apologies, I thought that the client ran the world gen code for single player games. The client actually runs a local instance of the server?
May 21, 20205 yr Author Understood, thank you! Let me readjust my question in that case I would like to execute arbitrary code once the world gen has finished, ie "Hello world".
May 21, 20205 yr it's hard to answer without knowing what you need, but maybe you are yet to determine what you need... try this: respond to "join world" event; if the entity that fired event is a player, do your stuff and leave a simple signature in player's extra data (nbt). check for that signature at the start of "join world" event handler and don't do anything if it's not the first time for player to join. things to note: 1) the event mentioned above fires for every player on the server instance and on any number of client instances. you may want to check whether world is remote (meaning client). 2) your signature (if it's a nbt string) needs to be below "persisted_nbt_tag" so that you wouldn't need to handle player "clone" event and copy the signature (i haven't checked whether that's still a thing in 1.15, but i'm willing to bet it is). give it a try. if it's too early for you, there are ways of delaying things for a few seconds... Edited May 21, 20205 yr by MFMods
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.