SimulationChunkTracker.java
net.minecraft.server.level.SimulationChunkTracker
信息
- 全限定名:net.minecraft.server.level.SimulationChunkTracker
- 类型:public class
- 包:net.minecraft.server.level
- 源码路径:src/main/java/net/minecraft/server/level/SimulationChunkTracker.java
- 起始行号:L8
- 继承:ChunkTracker
- 职责:
TODO
字段/常量
-
MAX_LEVEL- 类型:
int - 修饰符:
public static final - 源码定位:
L9 - 说明:
TODO
- 类型:
-
chunks- 类型:
Long2ByteMap - 修饰符:
protected final - 源码定位:
L10 - 说明:
TODO
- 类型:
-
ticketStorage- 类型:
TicketStorage - 修饰符:
private final - 源码定位:
L11 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public SimulationChunkTracker(TicketStorage ticketStorage) @ L13
- 构造器名:SimulationChunkTracker
- 源码定位:L13
- 修饰符:public
参数:
- ticketStorage: TicketStorage
说明:
TODO
方法
下面的方法块按源码顺序生成。
protected int getLevelFromSource(long to) @ L20
- 方法名:getLevelFromSource
- 源码定位:L20
- 返回类型:int
- 修饰符:protected
参数:
- to: long
说明:
TODO
public int getLevel(ChunkPos node) @ L25
- 方法名:getLevel
- 源码定位:L25
- 返回类型:int
- 修饰符:public
参数:
- node: ChunkPos
说明:
TODO
protected int getLevel(long node) @ L29
- 方法名:getLevel
- 源码定位:L29
- 返回类型:int
- 修饰符:protected
参数:
- node: long
说明:
TODO
protected void setLevel(long node, int level) @ L34
- 方法名:setLevel
- 源码定位:L34
- 返回类型:void
- 修饰符:protected
参数:
- node: long
- level: int
说明:
TODO
public void runAllUpdates() @ L43
- 方法名:runAllUpdates
- 源码定位:L43
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
代码
public class SimulationChunkTracker extends ChunkTracker {
public static final int MAX_LEVEL = 33;
protected final Long2ByteMap chunks = new Long2ByteOpenHashMap();
private final TicketStorage ticketStorage;
public SimulationChunkTracker(TicketStorage ticketStorage) {
super(34, 16, 256);
this.ticketStorage = ticketStorage;
ticketStorage.setSimulationChunkUpdatedListener(this::update);
this.chunks.defaultReturnValue((byte)33);
}
@Override
protected int getLevelFromSource(long to) {
return this.ticketStorage.getTicketLevelAt(to, true);
}
public int getLevel(ChunkPos node) {
return this.getLevel(node.pack());
}
@Override
protected int getLevel(long node) {
return this.chunks.get(node);
}
@Override
protected void setLevel(long node, int level) {
if (level >= 33) {
this.chunks.remove(node);
} else {
this.chunks.put(node, (byte)level);
}
}
public void runAllUpdates() {
this.runUpdates(Integer.MAX_VALUE);
}
}引用的其他类
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置: