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

I have a block entity which I want to tick only in certain cases. I want to enable ticking based on user interaction, and disable it based on internal logic. This is for performance reasons. I have implemented the ticker using getTicker, but I am not sure how to terminate it. I found that updating the block state calls the method to get the ticker. Do I have to do something with this block state, so that I can return null in the getTicker method? Or, can I just remove and add the ticker some other way?

You should either keep the block state ticking or not have it tick. You can essentially emulate not ticking by doing nothing in the tick method. If you really wanted to remove the ticker, you could use a separate BlockState to determine whether the ticker exists or is null.

  • Author
3 minutes ago, ChampionAsh5357 said:

You should either keep the block state ticking or not have it tick. You can essentially emulate not ticking by doing nothing in the tick method. If you really wanted to remove the ticker, you could use a separate BlockState to determine whether the ticker exists or is null.

I wanted to preserve performance, as I mentioned. I'll have thousands of those block entities in the world. I've implemented the blockstate method and did not like it very much, so I opted for an access transformer.

22 minutes ago, Alioth Merak said:

I wanted to preserve performance, as I mentioned. I'll have thousands of those block entities in the world. I've implemented the blockstate method and did not like it very much, so I opted for an access transformer.

Sure, though I typically don't recommend reflection or ATs if there is a viable alternative without them.

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.