Posted February 5, 20232 yr 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?
February 6, 20232 yr 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.
February 6, 20232 yr 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.
February 6, 20232 yr 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.