ChunkLevel.java
net.minecraft.server.level.ChunkLevel
信息
- 全限定名:net.minecraft.server.level.ChunkLevel
- 类型:public class
- 包:net.minecraft.server.level
- 源码路径:src/main/java/net/minecraft/server/level/ChunkLevel.java
- 起始行号:L9
- 职责:
TODO
字段/常量
-
FULL_CHUNK_LEVEL- 类型:
int - 修饰符:
private static final - 源码定位:
L10 - 说明:
TODO
- 类型:
-
BLOCK_TICKING_LEVEL- 类型:
int - 修饰符:
private static final - 源码定位:
L11 - 说明:
TODO
- 类型:
-
ENTITY_TICKING_LEVEL- 类型:
int - 修饰符:
private static final - 源码定位:
L12 - 说明:
TODO
- 类型:
-
FULL_CHUNK_STEP- 类型:
ChunkStep - 修饰符:
private static final - 源码定位:
L13 - 说明:
TODO
- 类型:
-
RADIUS_AROUND_FULL_CHUNK- 类型:
int - 修饰符:
public static final - 源码定位:
L14 - 说明:
TODO
- 类型:
-
MAX_LEVEL- 类型:
int - 修饰符:
public static final - 源码定位:
L15 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
- 无
方法
下面的方法块按源码顺序生成。
public static ChunkStatus generationStatus(int level) @ L17
- 方法名:generationStatus
- 源码定位:L17
- 返回类型:ChunkStatus
- 修饰符:public static
参数:
- level: int
说明:
TODO
public static ChunkStatus getStatusAroundFullChunk(int distanceToFullChunk, ChunkStatus defaultValue) @ L21
- 方法名:getStatusAroundFullChunk
- 源码定位:L21
- 返回类型:ChunkStatus
- 修饰符:public static
参数:
- distanceToFullChunk: int
- defaultValue: ChunkStatus
说明:
TODO
public static ChunkStatus getStatusAroundFullChunk(int distanceToFullChunk) @ L30
- 方法名:getStatusAroundFullChunk
- 源码定位:L30
- 返回类型:ChunkStatus
- 修饰符:public static
参数:
- distanceToFullChunk: int
说明:
TODO
public static int byStatus(ChunkStatus status) @ L34
- 方法名:byStatus
- 源码定位:L34
- 返回类型:int
- 修饰符:public static
参数:
- status: ChunkStatus
说明:
TODO
public static FullChunkStatus fullStatus(int level) @ L38
- 方法名:fullStatus
- 源码定位:L38
- 返回类型:FullChunkStatus
- 修饰符:public static
参数:
- level: int
说明:
TODO
public static int byStatus(FullChunkStatus status) @ L48
- 方法名:byStatus
- 源码定位:L48
- 返回类型:int
- 修饰符:public static
参数:
- status: FullChunkStatus
说明:
TODO
public static boolean isEntityTicking(int level) @ L57
- 方法名:isEntityTicking
- 源码定位:L57
- 返回类型:boolean
- 修饰符:public static
参数:
- level: int
说明:
TODO
public static boolean isBlockTicking(int level) @ L61
- 方法名:isBlockTicking
- 源码定位:L61
- 返回类型:boolean
- 修饰符:public static
参数:
- level: int
说明:
TODO
public static boolean isLoaded(int level) @ L65
- 方法名:isLoaded
- 源码定位:L65
- 返回类型:boolean
- 修饰符:public static
参数:
- level: int
说明:
TODO
代码
public class ChunkLevel {
private static final int FULL_CHUNK_LEVEL = 33;
private static final int BLOCK_TICKING_LEVEL = 32;
private static final int ENTITY_TICKING_LEVEL = 31;
private static final ChunkStep FULL_CHUNK_STEP = ChunkPyramid.GENERATION_PYRAMID.getStepTo(ChunkStatus.FULL);
public static final int RADIUS_AROUND_FULL_CHUNK = FULL_CHUNK_STEP.accumulatedDependencies().getRadius();
public static final int MAX_LEVEL = 33 + RADIUS_AROUND_FULL_CHUNK;
public static @Nullable ChunkStatus generationStatus(int level) {
return getStatusAroundFullChunk(level - 33, null);
}
@Contract("_,!null->!null;_,_->_")
public static @Nullable ChunkStatus getStatusAroundFullChunk(int distanceToFullChunk, @Nullable ChunkStatus defaultValue) {
if (distanceToFullChunk > RADIUS_AROUND_FULL_CHUNK) {
return defaultValue;
} else {
return distanceToFullChunk <= 0 ? ChunkStatus.FULL : FULL_CHUNK_STEP.accumulatedDependencies().get(distanceToFullChunk);
}
}
public static ChunkStatus getStatusAroundFullChunk(int distanceToFullChunk) {
return getStatusAroundFullChunk(distanceToFullChunk, ChunkStatus.EMPTY);
}
public static int byStatus(ChunkStatus status) {
return 33 + FULL_CHUNK_STEP.getAccumulatedRadiusOf(status);
}
public static FullChunkStatus fullStatus(int level) {
if (level <= 31) {
return FullChunkStatus.ENTITY_TICKING;
} else if (level <= 32) {
return FullChunkStatus.BLOCK_TICKING;
} else {
return level <= 33 ? FullChunkStatus.FULL : FullChunkStatus.INACCESSIBLE;
}
}
public static int byStatus(FullChunkStatus status) {
return switch (status) {
case INACCESSIBLE -> MAX_LEVEL;
case FULL -> 33;
case BLOCK_TICKING -> 32;
case ENTITY_TICKING -> 31;
};
}
public static boolean isEntityTicking(int level) {
return level <= 31;
}
public static boolean isBlockTicking(int level) {
return level <= 32;
}
public static boolean isLoaded(int level) {
return level <= MAX_LEVEL;
}
}引用的其他类
-
- 引用位置:
参数/返回值
- 引用位置:
-
- 引用位置:
参数/返回值
- 引用位置:
-
- 引用位置:
字段
- 引用位置: