blob: e00fc1c7702ad95ed5385095d72c3bcc4284816b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package gregtech.api.objects.blockupdate;
public class Cooldown {
public Cooldown(int aLengthInTicks) {
if (aLengthInTicks <= 0) throw new IllegalArgumentException("length should be a positive non-zero number");
this.lengthInTicks = aLengthInTicks;
this.lastTimeStarted = 0;
}
public void set(long currTickTime) {
lastTimeStarted = currTickTime;
}
public boolean hasPassed(long currTickTime) {
return currTickTime - lastTimeStarted >= lengthInTicks;
}
public long getLastTimeStarted() {
return lastTimeStarted;
}
private long lastTimeStarted;
protected int lengthInTicks;
}
|