Jump to content

[1.12] ClientTickEvent problems


Wehavecookies56

Recommended Posts

So am I right in saying that ClientTickEvent should fire twice each tick? 1 for the start phase and 1 for the end phase.

Since I have found that it fires twice per phase each tick, I simply made it print the phase and I get this:

[11:33:11] [main/INFO] [STDOUT]: [uk.co.wehavecookies56.kk.client.core.handler.ClientEventHandler:onClientTick:26]: START
[11:33:11] [main/INFO] [STDOUT]: [uk.co.wehavecookies56.kk.client.core.handler.ClientEventHandler:onClientTick:26]: START
[11:33:11] [main/INFO] [STDOUT]: [uk.co.wehavecookies56.kk.client.core.handler.ClientEventHandler:onClientTick:26]: END
[11:33:11] [main/INFO] [STDOUT]: [uk.co.wehavecookies56.kk.client.core.handler.ClientEventHandler:onClientTick:26]: END
[11:33:11] [main/INFO] [STDOUT]: [uk.co.wehavecookies56.kk.client.core.handler.ClientEventHandler:onClientTick:26]: START
[11:33:11] [main/INFO] [STDOUT]: [uk.co.wehavecookies56.kk.client.core.handler.ClientEventHandler:onClientTick:26]: START
[11:33:11] [main/INFO] [STDOUT]: [uk.co.wehavecookies56.kk.client.core.handler.ClientEventHandler:onClientTick:26]: END
[11:33:11] [main/INFO] [STDOUT]: [uk.co.wehavecookies56.kk.client.core.handler.ClientEventHandler:onClientTick:26]: END
[11:33:11] [main/INFO] [STDOUT]: [uk.co.wehavecookies56.kk.client.core.handler.ClientEventHandler:onClientTick:26]: START
[11:33:11] [main/INFO] [STDOUT]: [uk.co.wehavecookies56.kk.client.core.handler.ClientEventHandler:onClientTick:26]: START

Here's my event handler code:
 

@SubscribeEvent
public void onClientTick(TickEvent.ClientTickEvent event) {
	System.out.println(event.phase);
}

This means that even after checking for a phase everything is run twice in the same tick. Which seemingly I can't prevent as any checks to prevent things from running a second time do not work as they happen at the same time.

If I am wrong about how the event works and that it firing twice per phase is how it is supposed to work how should I prevent code being run twice in the end or start phase?

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.