Jump to content

[1.7.10][NAH, SOLVED] PE.PlayerLoggedIn and PE.LivingUpdateEvent


Recommended Posts

Posted

Lately I've been having fun in this field and after debugging for some time it occured to me that those 2 events have race conditions are missleading.

 

net.minecraftforge.event.entity.player.PlayerEvent.LivingUpdateEvent

is being registered by MinecraftForge.EVENT_BUS.register();

 

package cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent

is being registered by FMLCommonHandler.instance().bus().register();

 

I know those 2 BUSes (FML and Forge) are totally different, but it just doesn't seem right that EntityUpdateEvent occurs before Entity has even appeared in the world been confirmed logged in. Even more weird is the fact that those both SEEM to be SERVER side, so its not like Client is doing something here.

 

//EDIT - LoggedIn is really called before Update BUT, if you place something too heavy there (like I did - reading json, it will have race condition with UpdateEvent, and therefore UpdateEvent might crash if it's using data that should be loaded with LoggedIn and there are no null checks and stuff.

Last but not least - the fact that this is totally random (one time the first will go off 1st, other the 2nd) makes this a race condition (or something near it, whatever).

Question:

Is it possible that someone missed this fact and it's a bug?

Could not be a bug.

 

Whats the point of PlayerLoggedInEvent if it might pawn whole loading method when used alongside UpdateEvents?

(I mean there is a point, but it can cause crashes)

 

Is there maybe some sub-event that will work like I want (LoggedIn -> Update)?

(If not, I'll have to add bool mappings for players and check if they are after "LoggedIn" event)

1.7.10 is no longer supported by forge, you are on your own.

Posted

I'm not sure but I think the player logged in event likely requires more network handshaking which would provide some variability.  Like maybe during the actual log in sequence the server decides it should spawn the player entity so the living update starts to tick but maybe the logged in event still requires some acknowledgement from the client.

 

I'm just guessing and haven't looked into it, but it seems to me that "logging in" could be a process that has variability in it.

 

I agree it does seem like an annoying race condition though.  But I could see how it could logically exist.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Yup, got few method calls back and got this:

 

net.minecraft.server.management.ServerConfigurationManager.initializeConnectionToPlayer

 

Final Edit: [sOLVED]

From 1st post (edited):

//EDIT - LoggedIn is really called before Update BUT, if you place something too heavy there (like I did - reading json, it will have race condition with UpdateEvent, and therefore UpdateEvent might crash if it's using data that should be loaded with LoggedIn and there are no null checks and stuff.

1.7.10 is no longer supported by forge, you are on your own.

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.