TickThrottler.java
net.minecraft.util.TickThrottler
信息
- 全限定名:net.minecraft.util.TickThrottler
- 类型:public class
- 包:net.minecraft.util
- 源码路径:src/main/java/net/minecraft/util/TickThrottler.java
- 起始行号:L3
- 职责:
TODO
字段/常量
-
incrementStep- 类型:
int - 修饰符:
private final - 源码定位:
L4 - 说明:
TODO
- 类型:
-
threshold- 类型:
int - 修饰符:
private final - 源码定位:
L5 - 说明:
TODO
- 类型:
-
count- 类型:
int - 修饰符:
private - 源码定位:
L6 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public TickThrottler(int incrementStep, int threshold) @ L8
- 构造器名:TickThrottler
- 源码定位:L8
- 修饰符:public
参数:
- incrementStep: int
- threshold: int
说明:
TODO
方法
下面的方法块按源码顺序生成。
public void increment() @ L13
- 方法名:increment
- 源码定位:L13
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public void tick() @ L17
- 方法名:tick
- 源码定位:L17
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public boolean isUnderThreshold() @ L23
- 方法名:isUnderThreshold
- 源码定位:L23
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
代码
public class TickThrottler {
private final int incrementStep;
private final int threshold;
private int count;
public TickThrottler(int incrementStep, int threshold) {
this.incrementStep = incrementStep;
this.threshold = threshold;
}
public void increment() {
this.count = this.count + this.incrementStep;
}
public void tick() {
if (this.count > 0) {
this.count--;
}
}
public boolean isUnderThreshold() {
return this.count < this.threshold;
}
}引用的其他类
- 无