This Article is up to date with Custom Stuff 2 |
---|
Tickrate is a block's "timer" that it uses for a few functions. Foremost, it defines how often the onUpdate event trigger is activated. Second, for liquid-type blocks, it defines how quickly the fluid flows.
There are 20 ticks per second. By default, this value is set to 10, meaning it will update twice per second. Setting this value to 1 will cause it to update every tick, or 20 times per second. Setting it higher will cause it to update less often. For blocks that have no reason to update, it is suggested that you set this value extremely high to cut down on unnecessary block updates.
To change this value from it's default, add the following line to your block's .js file:
tickrate = 72000; //This will cause the block to update only once every hour.
Here are some more examples:
tickrate = 1200; //This will cause the block to update once every minute.
tickrate = 20; //This is a 1 per second.
tickrate = 1; //This is the fastest the game goes with 20 ticks per second.
Note 1: All times are approximate and depend on whether or not the block is in a loaded chunk, and the speed of your processor. Any frame chug (game lag) will slow down the exact amount of time slightly. Inversely, a lot of blocks with frequent updates may also cause the game to slow down as it processes them all.
Note 2: This is based on "game ticks" and not "redstone ticks". If using the onUpdate trigger to activate something involving redstone, a tickrate of 1 will be a "half tick" of redstone, which should be used carefully as it can cause mechanisms like pistons to malfunction. Redstone operates on 10 ticks per second, so you should effectively 'double' the value for this attribute if it will be interacting with redstone. 2 game ticks = 1 redstone tick.