Jump to content

[1.7.10] How often block.updateTick is called?


Elix_x

Recommended Posts

Hello everybody!

 

After working on some time related mechanics, i ran into question: how often block.updateTick is normally called?

It's for sure not every tick, that's what are my results for now...

 

Thanks for help!

If you have any questions - just ask!

Link to comment
Share on other sites

It can be every tick, but normally it's not called at all unless you specifically schedule an update tick (which you could do every single tick). For blocks that are set to tick randomly, it is called somewhat regularly based on the tick rate you return from tickRate(World).

So basically, if it returns 10 it means each 10th tick? Or each tick with 1 chance out of 10?

Thanks so much!

Link to comment
Share on other sites

based on the tick rate you return from tickRate(World).

This is not true. You cannot specify the tick rate for random ticks. The tickRate method does nothing.

Apearently, yes. Going though call hierarchy of tickRate showed only BlockStairs and only BlockStairs.

Then how often/with which chance is updateTick called?

Link to comment
Share on other sites

If you do nothing it is not called at all.

If you do setTickRandomly(true) it will be called randomly, see the Minecraft Wiki for details.

If you call world.scheduleBlockUpdate it will be called as many ticks later as you specified there.

So basically each block has one chance out of 1365 to be ticked. That's interesting...

Link to comment
Share on other sites

based on the tick rate you return from tickRate(World).

This is not true. You cannot specify the tick rate for random ticks. The tickRate method does nothing.

Are you sure? When I tested it out before, it definitely seemed to affect how often the updateTick method was called, but that was way back in 1.6.4, of which my memory is a bit foggy, so...

 

Hm, yeah it seems tickRate isn't really used anywhere other than (in 1.8) for trip wire hooks which use it when scheduling a block update, and in Forge's BlockFluidFinite class. In 1.7.10, it's only used for stairs, and not really even there because it just returns a different block's tick rate.

 

Really makes one wonder sometimes, doesn't it? It's probably legacy code that Mojang just hasn't gotten around to removing (I hope).

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.