Jump to content

Times Block Events - Server Performance


Recommended Posts

Hi All, just a quick one to get some opinions prior to me going off on one  :o


I am thinking of making a block that when you hit it does stuff then changes state so it cant be hit again for an hour. I have had a look at how furnaces work with regard to timing the baking process etc. and switching visual state and it basically looks like a counter that counts the ticks and when this gets to Y it triggers the functionality to reset the block to its original state.


Before I crack on I wanted to check with you guys (who are way more experienced than I on such matters) what the impact of this might me when it scales. If in the hour 1000 blocks are set off, would these 1000 counters cause server performance issues?


This may be me being overly paranoid but I'm throwing it out there just in case.


Thanks as always,



Link to comment
Share on other sites

In 1.8 TileEntities have been nicely split into "dead" ones that don't tick, just hold data and the "ticking" ones.


You want to use ticking ones. (IUpdatePlayerListBox)


Now - if you are planning on having SIMPLE incrementation and if check in onUpdate() then, what can I say...

Having even 10000 blocks like that would be literally 10000 iterations (world.tickableTileEntities) and few light operations.


Performance hit? Nah. Should you do that? If you must. TE shouldn't be used for super-common blocks like e.g cobble.


Other suggestions:

Have look at Block.randomTick(...) used by e.g crops to grow. You might want to randomize your timer to work with "close to hour intervals".

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Don't tick - use a 'long' to save the next time it will become active, and when the player tries to interact with it, check if the current world time has surpassed the stored time and you're golden.


Unless, of course, you need your block to reset immediately when it next becomes available (visually, for example), then you will unfortunately need to tick, but you can still use the world time implementation so you don't have to increment / decrement a counter.

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.

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.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.