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.

Featured Replies

Posted

Here's how stuff happens: (in order)

*** Server constructs player ->Player gets his IEEP -> Joins server world -> Client constructs player -> Player gets his IEEP -> Joins client world. ***

 

Now - I can't send any packet from server->client before client constructs him. ### How can I do this without using Client-request packet (which till now I'm doing). ###

Note: I can't use PlayerLoggedInEvent since it's not fired on respawning. When player respawns events go same as in *** above, there is just PlayerEvent.Clone launched (server-side) after construction.

 

Some time ago I posted similar thread, but since that I've learned about Tracking (PlayerEvent.StartTracking and few other tricks which are server-side). Sadly StartTracking is not working for player himself (event.target is never him).

So that leaves question: Is there a way to know when player starts tracking himself (start tracking happens after client alredy has his PlayerEntity which would solve ### part)?

 

Goal: Send synchro packet to player after he reconstructs (no matter why - login/respawn). Ofc do it without using ticks and client-side requests.

 

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

EntityJoinWorldEvent works perfectly for this, too, if you want to catch both login and respawn in one event, but it fires for all entities so you have to check if it's a player so it's probably less efficient than using the two specific events combined.

 

Still, if you are doing other stuff there already, it's handy.

  • Author

"Joins server world -> Client constructs player"

This here is perfect reason why I didn't use EntityJoinWorldEvent and was looking for events like ones proposed by diesieben (those ensure that client constructed PlayerEntity).

 

If you'd try to send packet from server->client in EntityJoinWorldEvent there is no guarantee the packet will arrive. Reason: Client haven't constructed PlayerEntity yet. All packets send to this refered player will be lost (not read).

 

Also funny thing: it seems like sometimes Joins server world is laucnhed after Client constructs player, In different situation different shit happens man. On Dedic one, on Integrated other. I have no idea what is the correct reason for this (because of 2 separate threads most likely), but I don't like randomness.

 

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

Sending from EntityJoinWorldEvent does work, unless you are you talking about 1.8? In that case, yes, you have to make sure you only process the packet on the main thread, otherwise you are right, the client player will not have been constructed yet.

 

I've used it plenty and it works fine for me, but use whatever works mate.

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.