Jump to content

What is ClientTickEvent doing?


Slashpwn

Recommended Posts

Hi guys,

 

I can't seem to find any documentation concerning ClientTickEvent. I've come across examples where people used it for accessing player data, but can't  decipher exactly what it does.

 

If any have a link to some website explaining stuff like this it would be awesome!

 

Cheers,

Link to comment
Share on other sites

ClientTickEvent itself isn't doing anything - it is posted twice per Minecraft run tick on the client side, from the Minecraft class. The first time is the START phase, and the second time is the END phase.

 

Since it is CLIENT side only, any player data retrieved at this point must have been kept updated from the server side via packets. Several things are kept in sync for you by Minecraft, but most things are not because they are not normally needed client-side.

 

What are you trying to do that made you look at ClientTickEvent?

Link to comment
Share on other sites

Thanks for the fast reply !

 

I was looking through some code (not made by me) which contained a method with the ClientTickEvent as a parameter. The method have a line where there is checked if the ClientTickEvent is in its END phase (I think).

 

    if(event.phase == Phase.END)

 

Do you know if there is a website with documentation of the different forge classes? I've looked through the github documentation and this one https://lazdude2012.github.io/YATS/index.html but they're quite limited in the amount of classes covered.

 

 

Link to comment
Share on other sites

It's a client-side tick notification, it can be used to keep things like potion durations updating correctly without having to wait for an update packet from the server, keeps the sun/moon/stars sliding smoothly across the heavens, etc.  You'll notice during periods of extreme lag that these values keep updating even though they're wrong and will "snap" back to the correct value when an update packet from the server does finally arrive (yes, even single player!).

 

Or at least, that's what vanilla does in between Phase.START and Phase.END, what a mod does with it is up to the mod, but that gives you an idea of the kinds of things that occur.

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

things like potion durations

No need for a tick event here, Potion class has isReady and performEffect methods which will be called.

 

I meant the visual display next to your inventory where it contains a timer (the "duration"), not the effect.

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

that gives you an idea of the kinds of things that occur.

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

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.