HeightMapRenderer.java
net.minecraft.client.renderer.debug.HeightMapRenderer
信息
- 全限定名:net.minecraft.client.renderer.debug.HeightMapRenderer
- 类型:public class
- 包:net.minecraft.client.renderer.debug
- 源码路径:src/main/java/net/minecraft/client/renderer/debug/HeightMapRenderer.java
- 起始行号:L22
- 实现:DebugRenderer.SimpleDebugRenderer
- 职责:
TODO
字段/常量
-
minecraft- 类型:
Minecraft - 修饰符:
private final - 源码定位:
L23 - 说明:
TODO
- 类型:
-
CHUNK_DIST- 类型:
int - 修饰符:
private static final - 源码定位:
L24 - 说明:
TODO
- 类型:
-
BOX_HEIGHT- 类型:
float - 修饰符:
private static final - 源码定位:
L25 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public HeightMapRenderer(Minecraft minecraft) @ L27
- 构造器名:HeightMapRenderer
- 源码定位:L27
- 修饰符:public
参数:
- minecraft: Minecraft
说明:
TODO
方法
下面的方法块按源码顺序生成。
public void emitGizmos(double camX, double camY, double camZ, DebugValueAccess debugValues, Frustum frustum, float partialTicks) @ L31
- 方法名:emitGizmos
- 源码定位:L31
- 返回类型:void
- 修饰符:public
参数:
- camX: double
- camY: double
- camZ: double
- debugValues: DebugValueAccess
- frustum: Frustum
- partialTicks: float
说明:
TODO
private Vector3f getColor(Heightmap.Types type) @ L61
- 方法名:getColor
- 源码定位:L61
- 返回类型:Vector3f
- 修饰符:private
参数:
- type: Heightmap.Types
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class HeightMapRenderer implements DebugRenderer.SimpleDebugRenderer {
private final Minecraft minecraft;
private static final int CHUNK_DIST = 2;
private static final float BOX_HEIGHT = 0.09375F;
public HeightMapRenderer(Minecraft minecraft) {
this.minecraft = minecraft;
}
@Override
public void emitGizmos(double camX, double camY, double camZ, DebugValueAccess debugValues, Frustum frustum, float partialTicks) {
LevelAccessor level = this.minecraft.level;
BlockPos playerPos = BlockPos.containing(camX, 0.0, camZ);
for (int chunkX = -2; chunkX <= 2; chunkX++) {
for (int chunkZ = -2; chunkZ <= 2; chunkZ++) {
ChunkAccess chunk = level.getChunk(playerPos.offset(chunkX * 16, 0, chunkZ * 16));
for (Entry<Heightmap.Types, Heightmap> heightmapEntry : chunk.getHeightmaps()) {
Heightmap.Types type = heightmapEntry.getKey();
ChunkPos chunkPos = chunk.getPos();
Vector3f color = this.getColor(type);
for (int relativeX = 0; relativeX < 16; relativeX++) {
for (int relativeZ = 0; relativeZ < 16; relativeZ++) {
int xx = SectionPos.sectionToBlockCoord(chunkPos.x(), relativeX);
int zz = SectionPos.sectionToBlockCoord(chunkPos.z(), relativeZ);
float height = level.getHeight(type, xx, zz) + type.ordinal() * 0.09375F;
Gizmos.cuboid(
new AABB(xx + 0.25F, height, zz + 0.25F, xx + 0.75F, height + 0.09375F, zz + 0.75F),
GizmoStyle.fill(ARGB.colorFromFloat(1.0F, color.x(), color.y(), color.z()))
);
}
}
}
}
}
}
private Vector3f getColor(Heightmap.Types type) {
return switch (type) {
case WORLD_SURFACE_WG -> new Vector3f(1.0F, 1.0F, 0.0F);
case OCEAN_FLOOR_WG -> new Vector3f(1.0F, 0.0F, 1.0F);
case WORLD_SURFACE -> new Vector3f(0.0F, 0.7F, 0.0F);
case OCEAN_FLOOR -> new Vector3f(0.0F, 0.0F, 0.5F);
case MOTION_BLOCKING -> new Vector3f(0.0F, 0.3F, 0.3F);
case MOTION_BLOCKING_NO_LEAVES -> new Vector3f(0.0F, 0.5F, 0.5F);
};
}
}引用的其他类
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
实现
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
BlockPos.containing()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
SectionPos.sectionToBlockCoord()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
GizmoStyle.fill()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Gizmos.cuboid()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
ARGB.colorFromFloat()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
AABB()
- 引用位置: