Package forestry.api.util
Class TickHelper
java.lang.Object
forestry.api.util.TickHelper
Helper object used to execute update logic on every tick interval.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonTick()Must be called every tick to keep track of the total number of ticks.booleanupdateOnInterval(int tickInterval) Used to check if a certain number of ticks has elapsed.
-
Constructor Details
-
TickHelper
public TickHelper(int offset) Create a new tick helper.- Parameters:
offset- A random offset used to avoid other TickHelpers on the same interval all ticking at the same time.
-
-
Method Details
-
onTick
public void onTick()Must be called every tick to keep track of the total number of ticks. -
updateOnInterval
public boolean updateOnInterval(int tickInterval) Used to check if a certain number of ticks has elapsed.- Parameters:
tickInterval- The tick interval for which this method should return true. For example, a tickInterval of 60 would return true every three seconds.- Returns:
- Whether enough ticks have elapsed since the last time this method returned true.
-