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

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?

  • Author

Now that you mention where it's been registered...

It's all my fault just checked again where I had it registered and well it was registered in both the init and postInit, now it makes sense why it was firing twice xD

So no problem here everything is working fine -_-

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.