DebugScreenOverlay.java
net.minecraft.client.gui.components.DebugScreenOverlay
信息
- 全限定名:net.minecraft.client.gui.components.DebugScreenOverlay
- 类型:public class
- 包:net.minecraft.client.gui.components
- 源码路径:src/main/java/net/minecraft/client/gui/components/DebugScreenOverlay.java
- 起始行号:L70
- 职责:
TODO
字段/常量
-
CROSSHAIR_SCALE- 类型:
float - 修饰符:
private static final - 源码定位:
L71 - 说明:
TODO
- 类型:
-
CROSSHAIR_INDEX_COUNT- 类型:
int - 修饰符:
private static final - 源码定位:
L72 - 说明:
TODO
- 类型:
-
MARGIN_RIGHT- 类型:
int - 修饰符:
private static final - 源码定位:
L73 - 说明:
TODO
- 类型:
-
MARGIN_LEFT- 类型:
int - 修饰符:
private static final - 源码定位:
L74 - 说明:
TODO
- 类型:
-
MARGIN_TOP- 类型:
int - 修饰符:
private static final - 源码定位:
L75 - 说明:
TODO
- 类型:
-
minecraft- 类型:
Minecraft - 修饰符:
private final - 源码定位:
L76 - 说明:
TODO
- 类型:
-
font- 类型:
Font - 修饰符:
private final - 源码定位:
L77 - 说明:
TODO
- 类型:
-
crosshairBuffer- 类型:
GpuBuffer - 修饰符:
private final - 源码定位:
L78 - 说明:
TODO
- 类型:
-
crosshairIndicies- 类型:
RenderSystem.AutoStorageIndexBuffer - 修饰符:
private final - 源码定位:
L79 - 说明:
TODO
- 类型:
-
lastPos- 类型:
ChunkPos - 修饰符:
private - 源码定位:
L80 - 说明:
TODO
- 类型:
-
clientChunk- 类型:
LevelChunk - 修饰符:
private - 源码定位:
L81 - 说明:
TODO
- 类型:
-
serverChunk- 类型:
CompletableFuture<LevelChunk> - 修饰符:
private - 源码定位:
L82 - 说明:
TODO
- 类型:
-
renderProfilerChart- 类型:
boolean - 修饰符:
private - 源码定位:
L83 - 说明:
TODO
- 类型:
-
renderFpsCharts- 类型:
boolean - 修饰符:
private - 源码定位:
L84 - 说明:
TODO
- 类型:
-
renderNetworkCharts- 类型:
boolean - 修饰符:
private - 源码定位:
L85 - 说明:
TODO
- 类型:
-
renderLightmapTexture- 类型:
boolean - 修饰符:
private - 源码定位:
L86 - 说明:
TODO
- 类型:
-
frameTimeLogger- 类型:
LocalSampleLogger - 修饰符:
private final - 源码定位:
L87 - 说明:
TODO
- 类型:
-
tickTimeLogger- 类型:
LocalSampleLogger - 修饰符:
private final - 源码定位:
L88 - 说明:
TODO
- 类型:
-
pingLogger- 类型:
LocalSampleLogger - 修饰符:
private final - 源码定位:
L89 - 说明:
TODO
- 类型:
-
bandwidthLogger- 类型:
LocalSampleLogger - 修饰符:
private final - 源码定位:
L90 - 说明:
TODO
- 类型:
-
remoteSupportingLoggers- 类型:
Map<RemoteDebugSampleType,LocalSampleLogger> - 修饰符:
private final - 源码定位:
L91 - 说明:
TODO
- 类型:
-
fpsChart- 类型:
FpsDebugChart - 修饰符:
private final - 源码定位:
L92 - 说明:
TODO
- 类型:
-
tpsChart- 类型:
TpsDebugChart - 修饰符:
private final - 源码定位:
L93 - 说明:
TODO
- 类型:
-
pingChart- 类型:
PingDebugChart - 修饰符:
private final - 源码定位:
L94 - 说明:
TODO
- 类型:
-
bandwidthChart- 类型:
BandwidthDebugChart - 修饰符:
private final - 源码定位:
L95 - 说明:
TODO
- 类型:
-
profilerPieChart- 类型:
ProfilerPieChart - 修饰符:
private final - 源码定位:
L96 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public DebugScreenOverlay(Minecraft minecraft) @ L98
- 构造器名:DebugScreenOverlay
- 源码定位:L98
- 修饰符:public
参数:
- minecraft: Minecraft
说明:
TODO
方法
下面的方法块按源码顺序生成。
public void clearChunkCache() @ L130
- 方法名:clearChunkCache
- 源码定位:L130
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public void extractRenderState(GuiGraphicsExtractor graphics) @ L135
- 方法名:extractRenderState
- 源码定位:L135
- 返回类型:void
- 修饰符:public
参数:
- graphics: GuiGraphicsExtractor
说明:
TODO
private static String formatChart(KeyMapping keyDebugModifier, KeyMapping keybind, String name, boolean status) @ L315
- 方法名:formatChart
- 源码定位:L315
- 返回类型:String
- 修饰符:private static
参数:
- keyDebugModifier: KeyMapping
- keybind: KeyMapping
- name: String
- status: boolean
说明:
TODO
private static String formatKeybind(KeyMapping keyDebugModifier, KeyMapping keybind) @ L319
- 方法名:formatKeybind
- 源码定位:L319
- 返回类型:String
- 修饰符:private static
参数:
- keyDebugModifier: KeyMapping
- keybind: KeyMapping
说明:
TODO
private void extractLines(GuiGraphicsExtractor graphics, List<String> lines, boolean alignLeft) @ L326
- 方法名:extractLines
- 源码定位:L326
- 返回类型:void
- 修饰符:private
参数:
- graphics: GuiGraphicsExtractor
- lines: List
- alignLeft: boolean
说明:
TODO
private ServerLevel getServerLevel() @ L350
- 方法名:getServerLevel
- 源码定位:L350
- 返回类型:ServerLevel
- 修饰符:private
参数:
- 无
说明:
TODO
private Level getLevel() @ L359
- 方法名:getLevel
- 源码定位:L359
- 返回类型:Level
- 修饰符:private
参数:
- 无
说明:
TODO
private LevelChunk getServerChunk() @ L368
- 方法名:getServerChunk
- 源码定位:L368
- 返回类型:LevelChunk
- 修饰符:private
参数:
- 无
说明:
TODO
private LevelChunk getClientChunk() @ L387
- 方法名:getClientChunk
- 源码定位:L387
- 返回类型:LevelChunk
- 修饰符:private
参数:
- 无
说明:
TODO
public boolean showDebugScreen() @ L399
- 方法名:showDebugScreen
- 源码定位:L399
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
public boolean showProfilerChart() @ L404
- 方法名:showProfilerChart
- 源码定位:L404
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
public boolean showNetworkCharts() @ L408
- 方法名:showNetworkCharts
- 源码定位:L408
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
public boolean showFpsCharts() @ L412
- 方法名:showFpsCharts
- 源码定位:L412
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
public boolean showLightmapTexture() @ L416
- 方法名:showLightmapTexture
- 源码定位:L416
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
public void toggleNetworkCharts() @ L420
- 方法名:toggleNetworkCharts
- 源码定位:L420
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public void toggleFpsCharts() @ L429
- 方法名:toggleFpsCharts
- 源码定位:L429
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public void toggleLightmapTexture() @ L438
- 方法名:toggleLightmapTexture
- 源码定位:L438
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public void toggleProfilerChart() @ L447
- 方法名:toggleProfilerChart
- 源码定位:L447
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public void logFrameDuration(long frameDuration) @ L454
- 方法名:logFrameDuration
- 源码定位:L454
- 返回类型:void
- 修饰符:public
参数:
- frameDuration: long
说明:
TODO
public LocalSampleLogger getTickTimeLogger() @ L458
- 方法名:getTickTimeLogger
- 源码定位:L458
- 返回类型:LocalSampleLogger
- 修饰符:public
参数:
- 无
说明:
TODO
public LocalSampleLogger getPingLogger() @ L462
- 方法名:getPingLogger
- 源码定位:L462
- 返回类型:LocalSampleLogger
- 修饰符:public
参数:
- 无
说明:
TODO
public LocalSampleLogger getBandwidthLogger() @ L466
- 方法名:getBandwidthLogger
- 源码定位:L466
- 返回类型:LocalSampleLogger
- 修饰符:public
参数:
- 无
说明:
TODO
public ProfilerPieChart getProfilerPieChart() @ L470
- 方法名:getProfilerPieChart
- 源码定位:L470
- 返回类型:ProfilerPieChart
- 修饰符:public
参数:
- 无
说明:
TODO
public void logRemoteSample(long[] sample, RemoteDebugSampleType type) @ L474
- 方法名:logRemoteSample
- 源码定位:L474
- 返回类型:void
- 修饰符:public
参数:
- sample: long[]
- type: RemoteDebugSampleType
说明:
TODO
public void reset() @ L481
- 方法名:reset
- 源码定位:L481
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public void render3dCrosshair(CameraRenderState cameraState, int guiScale) @ L487
- 方法名:render3dCrosshair
- 源码定位:L487
- 返回类型:void
- 修饰符:public
参数:
- cameraState: CameraRenderState
- guiScale: int
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class DebugScreenOverlay {
private static final float CROSSHAIR_SCALE = 0.01F;
private static final int CROSSHAIR_INDEX_COUNT = 36;
private static final int MARGIN_RIGHT = 2;
private static final int MARGIN_LEFT = 2;
private static final int MARGIN_TOP = 2;
private final Minecraft minecraft;
private final Font font;
private final GpuBuffer crosshairBuffer;
private final RenderSystem.AutoStorageIndexBuffer crosshairIndicies = RenderSystem.getSequentialBuffer(VertexFormat.Mode.LINES);
private @Nullable ChunkPos lastPos;
private @Nullable LevelChunk clientChunk;
private @Nullable CompletableFuture<LevelChunk> serverChunk;
private boolean renderProfilerChart;
private boolean renderFpsCharts;
private boolean renderNetworkCharts;
private boolean renderLightmapTexture;
private final LocalSampleLogger frameTimeLogger = new LocalSampleLogger(1);
private final LocalSampleLogger tickTimeLogger = new LocalSampleLogger(TpsDebugDimensions.values().length);
private final LocalSampleLogger pingLogger = new LocalSampleLogger(1);
private final LocalSampleLogger bandwidthLogger = new LocalSampleLogger(1);
private final Map<RemoteDebugSampleType, LocalSampleLogger> remoteSupportingLoggers = Map.of(RemoteDebugSampleType.TICK_TIME, this.tickTimeLogger);
private final FpsDebugChart fpsChart;
private final TpsDebugChart tpsChart;
private final PingDebugChart pingChart;
private final BandwidthDebugChart bandwidthChart;
private final ProfilerPieChart profilerPieChart;
public DebugScreenOverlay(Minecraft minecraft) {
this.minecraft = minecraft;
this.font = minecraft.font;
this.fpsChart = new FpsDebugChart(this.font, this.frameTimeLogger);
this.tpsChart = new TpsDebugChart(
this.font, this.tickTimeLogger, () -> minecraft.level == null ? 0.0F : minecraft.level.tickRateManager().millisecondsPerTick()
);
this.pingChart = new PingDebugChart(this.font, this.pingLogger);
this.bandwidthChart = new BandwidthDebugChart(this.font, this.bandwidthLogger);
this.profilerPieChart = new ProfilerPieChart(this.font);
try (ByteBufferBuilder byteBufferBuilder = ByteBufferBuilder.exactlySized(DefaultVertexFormat.POSITION_COLOR_NORMAL_LINE_WIDTH.getVertexSize() * 12 * 2)) {
BufferBuilder bufferBuilder = new BufferBuilder(byteBufferBuilder, VertexFormat.Mode.LINES, DefaultVertexFormat.POSITION_COLOR_NORMAL_LINE_WIDTH);
bufferBuilder.addVertex(0.0F, 0.0F, 0.0F).setColor(-16777216).setNormal(1.0F, 0.0F, 0.0F).setLineWidth(4.0F);
bufferBuilder.addVertex(1.0F, 0.0F, 0.0F).setColor(-16777216).setNormal(1.0F, 0.0F, 0.0F).setLineWidth(4.0F);
bufferBuilder.addVertex(0.0F, 0.0F, 0.0F).setColor(-16777216).setNormal(0.0F, 1.0F, 0.0F).setLineWidth(4.0F);
bufferBuilder.addVertex(0.0F, 1.0F, 0.0F).setColor(-16777216).setNormal(0.0F, 1.0F, 0.0F).setLineWidth(4.0F);
bufferBuilder.addVertex(0.0F, 0.0F, 0.0F).setColor(-16777216).setNormal(0.0F, 0.0F, 1.0F).setLineWidth(4.0F);
bufferBuilder.addVertex(0.0F, 0.0F, 1.0F).setColor(-16777216).setNormal(0.0F, 0.0F, 1.0F).setLineWidth(4.0F);
bufferBuilder.addVertex(0.0F, 0.0F, 0.0F).setColor(-65536).setNormal(1.0F, 0.0F, 0.0F).setLineWidth(2.0F);
bufferBuilder.addVertex(1.0F, 0.0F, 0.0F).setColor(-65536).setNormal(1.0F, 0.0F, 0.0F).setLineWidth(2.0F);
bufferBuilder.addVertex(0.0F, 0.0F, 0.0F).setColor(-16711936).setNormal(0.0F, 1.0F, 0.0F).setLineWidth(2.0F);
bufferBuilder.addVertex(0.0F, 1.0F, 0.0F).setColor(-16711936).setNormal(0.0F, 1.0F, 0.0F).setLineWidth(2.0F);
bufferBuilder.addVertex(0.0F, 0.0F, 0.0F).setColor(-8421377).setNormal(0.0F, 0.0F, 1.0F).setLineWidth(2.0F);
bufferBuilder.addVertex(0.0F, 0.0F, 1.0F).setColor(-8421377).setNormal(0.0F, 0.0F, 1.0F).setLineWidth(2.0F);
try (MeshData meshData = bufferBuilder.buildOrThrow()) {
this.crosshairBuffer = RenderSystem.getDevice().createBuffer(() -> "Crosshair vertex buffer", 32, meshData.vertexBuffer());
}
}
}
public void clearChunkCache() {
this.serverChunk = null;
this.clientChunk = null;
}
public void extractRenderState(GuiGraphicsExtractor graphics) {
Options options = this.minecraft.options;
if (this.minecraft.isGameLoadFinished() && (!options.hideGui || this.minecraft.screen != null)) {
Collection<Identifier> visibleEntries = this.minecraft.debugEntries.getCurrentlyEnabled();
if (!visibleEntries.isEmpty()) {
graphics.nextStratum();
ProfilerFiller profiler = Profiler.get();
profiler.push("debug");
ChunkPos chunkPos;
if (this.minecraft.getCameraEntity() != null && this.minecraft.level != null) {
BlockPos feetPos = this.minecraft.getCameraEntity().blockPosition();
chunkPos = ChunkPos.containing(feetPos);
} else {
chunkPos = null;
}
if (!Objects.equals(this.lastPos, chunkPos)) {
this.lastPos = chunkPos;
this.clearChunkCache();
}
final List<String> leftLines = new ArrayList<>();
final List<String> rightLines = new ArrayList<>();
final Map<Identifier, Collection<String>> groups = new LinkedHashMap<>();
final List<String> regularLines = new ArrayList<>();
DebugScreenDisplayer displayer = new DebugScreenDisplayer() {
{
Objects.requireNonNull(DebugScreenOverlay.this);
}
@Override
public void addPriorityLine(String line) {
if (leftLines.size() > rightLines.size()) {
rightLines.add(line);
} else {
leftLines.add(line);
}
}
@Override
public void addLine(String line) {
regularLines.add(line);
}
@Override
public void addToGroup(Identifier group, Collection<String> lines) {
groups.computeIfAbsent(group, k -> new ArrayList<>()).addAll(lines);
}
@Override
public void addToGroup(Identifier group, String lines) {
groups.computeIfAbsent(group, k -> new ArrayList<>()).add(lines);
}
};
Level level = this.getLevel();
for (Identifier id : visibleEntries) {
DebugScreenEntry entry = DebugScreenEntries.getEntry(id);
if (entry != null) {
entry.display(displayer, level, this.getClientChunk(), this.getServerChunk());
}
}
if (!leftLines.isEmpty()) {
leftLines.add("");
}
if (!rightLines.isEmpty()) {
rightLines.add("");
}
if (!regularLines.isEmpty()) {
int mid = (regularLines.size() + 1) / 2;
leftLines.addAll(regularLines.subList(0, mid));
rightLines.addAll(regularLines.subList(mid, regularLines.size()));
leftLines.add("");
if (mid < regularLines.size()) {
rightLines.add("");
}
}
List<Collection<String>> finalGroups = new ArrayList<>(groups.values());
if (!finalGroups.isEmpty()) {
int mid = (finalGroups.size() + 1) / 2;
for (int i = 0; i < finalGroups.size(); i++) {
Collection<String> lines = finalGroups.get(i);
if (!lines.isEmpty()) {
if (i < mid) {
leftLines.addAll(lines);
leftLines.add("");
} else {
rightLines.addAll(lines);
rightLines.add("");
}
}
}
}
if (this.minecraft.debugEntries.isOverlayVisible()) {
leftLines.add("");
boolean hasServer = this.minecraft.getSingleplayerServer() != null;
KeyMapping keyDebugModifier = options.keyDebugModifier;
leftLines.add(
"Debug charts: "
+ formatChart(keyDebugModifier, options.keyDebugPofilingChart, "Profiler", this.renderProfilerChart)
+ "; "
+ formatChart(keyDebugModifier, options.keyDebugFpsCharts, hasServer ? "FPS + TPS" : "FPS", this.renderFpsCharts)
+ ";"
);
leftLines.add(
formatChart(
keyDebugModifier,
options.keyDebugNetworkCharts,
!this.minecraft.isLocalServer() ? "Bandwidth + Ping" : "Ping",
this.renderNetworkCharts
)
+ "; "
+ formatChart(keyDebugModifier, options.keyDebugLightmapTexture, "Lightmap", this.renderLightmapTexture)
);
leftLines.add("To edit: press " + formatKeybind(keyDebugModifier, options.keyDebugDebugOptions));
}
this.extractLines(graphics, leftLines, true);
this.extractLines(graphics, rightLines, false);
graphics.nextStratum();
this.profilerPieChart.setBottomOffset(10);
if (this.showFpsCharts()) {
int scaledWidth = graphics.guiWidth();
int maxWidth = scaledWidth / 2;
this.fpsChart.extractRenderState(graphics, 0, this.fpsChart.getWidth(maxWidth));
if (this.tickTimeLogger.size() > 0) {
int width = this.tpsChart.getWidth(maxWidth);
this.tpsChart.extractRenderState(graphics, scaledWidth - width, width);
}
this.profilerPieChart.setBottomOffset(this.tpsChart.getFullHeight());
}
if (this.showNetworkCharts() && this.minecraft.getConnection() != null) {
int scaledWidth = graphics.guiWidth();
int maxWidth = scaledWidth / 2;
if (!this.minecraft.isLocalServer()) {
this.bandwidthChart.extractRenderState(graphics, 0, this.bandwidthChart.getWidth(maxWidth));
}
int width = this.pingChart.getWidth(maxWidth);
this.pingChart.extractRenderState(graphics, scaledWidth - width, width);
this.profilerPieChart.setBottomOffset(this.pingChart.getFullHeight());
}
if (this.showLightmapTexture()) {
GpuTextureView lightmapTextureView = this.minecraft.gameRenderer.levelLightmap();
int displaySize = 64;
int x = graphics.guiWidth() - 64 - 2;
int y = graphics.guiHeight() - 64 - 2;
graphics.fill(x - 1, y - 1, x + 64 + 1, y + 64 + 1, -16777216);
graphics.blit(
lightmapTextureView, RenderSystem.getSamplerCache().getClampToEdge(FilterMode.NEAREST), x, y, x + 64, y + 64, 0.0F, 1.0F, 1.0F, 0.0F
);
}
if (this.minecraft.debugEntries.isCurrentlyEnabled(DebugScreenEntries.VISUALIZE_CHUNKS_ON_SERVER)) {
IntegratedServer singleplayerServer = this.minecraft.getSingleplayerServer();
if (singleplayerServer != null && this.minecraft.player != null) {
ChunkLoadStatusView statusView = singleplayerServer.createChunkLoadStatusView(16 + ChunkLevel.RADIUS_AROUND_FULL_CHUNK);
statusView.moveTo(this.minecraft.player.level().dimension(), this.minecraft.player.chunkPosition());
LevelLoadingScreen.extractChunksForRendering(graphics, graphics.guiWidth() / 2, graphics.guiHeight() / 2, 4, 1, statusView);
}
}
try (Zone ignored = profiler.zone("profilerPie")) {
this.profilerPieChart.extractRenderState(graphics);
}
profiler.pop();
}
}
}
private static String formatChart(KeyMapping keyDebugModifier, KeyMapping keybind, String name, boolean status) {
return formatKeybind(keyDebugModifier, keybind) + " " + name + " " + (status ? "visible" : "hidden");
}
private static String formatKeybind(KeyMapping keyDebugModifier, KeyMapping keybind) {
return "["
+ (keyDebugModifier.isUnbound() ? "" : keyDebugModifier.getTranslatedKeyMessage().getString() + "+")
+ keybind.getTranslatedKeyMessage().getString()
+ "]";
}
private void extractLines(GuiGraphicsExtractor graphics, List<String> lines, boolean alignLeft) {
int height = 9;
for (int i = 0; i < lines.size(); i++) {
String line = lines.get(i);
if (!Strings.isNullOrEmpty(line)) {
int width = this.font.width(line);
int left = alignLeft ? 2 : graphics.guiWidth() - 2 - width;
int top = 2 + height * i;
graphics.fill(left - 1, top - 1, left + width + 1, top + height - 1, -1873784752);
}
}
for (int ix = 0; ix < lines.size(); ix++) {
String line = lines.get(ix);
if (!Strings.isNullOrEmpty(line)) {
int width = this.font.width(line);
int left = alignLeft ? 2 : graphics.guiWidth() - 2 - width;
int top = 2 + height * ix;
graphics.text(this.font, line, left, top, -2039584, false);
}
}
}
private @Nullable ServerLevel getServerLevel() {
if (this.minecraft.level == null) {
return null;
} else {
IntegratedServer server = this.minecraft.getSingleplayerServer();
return server != null ? server.getLevel(this.minecraft.level.dimension()) : null;
}
}
private @Nullable Level getLevel() {
return this.minecraft.level == null
? null
: DataFixUtils.orElse(
Optional.ofNullable(this.minecraft.getSingleplayerServer()).flatMap(s -> Optional.ofNullable(s.getLevel(this.minecraft.level.dimension()))),
this.minecraft.level
);
}
private @Nullable LevelChunk getServerChunk() {
if (this.minecraft.level != null && this.lastPos != null) {
if (this.serverChunk == null) {
ServerLevel level = this.getServerLevel();
if (level == null) {
return null;
}
this.serverChunk = level.getChunkSource()
.getChunkFuture(this.lastPos.x(), this.lastPos.z(), ChunkStatus.FULL, false)
.thenApply(chunkResult -> (LevelChunk)chunkResult.orElse(null));
}
return this.serverChunk.getNow(null);
} else {
return null;
}
}
private @Nullable LevelChunk getClientChunk() {
if (this.minecraft.level != null && this.lastPos != null) {
if (this.clientChunk == null) {
this.clientChunk = this.minecraft.level.getChunk(this.lastPos.x(), this.lastPos.z());
}
return this.clientChunk;
} else {
return null;
}
}
public boolean showDebugScreen() {
DebugScreenEntryList entries = this.minecraft.debugEntries;
return (entries.isOverlayVisible() || !entries.getCurrentlyEnabled().isEmpty()) && (!this.minecraft.options.hideGui || this.minecraft.screen != null);
}
public boolean showProfilerChart() {
return this.minecraft.debugEntries.isOverlayVisible() && this.renderProfilerChart;
}
public boolean showNetworkCharts() {
return this.minecraft.debugEntries.isOverlayVisible() && this.renderNetworkCharts;
}
public boolean showFpsCharts() {
return this.minecraft.debugEntries.isOverlayVisible() && this.renderFpsCharts;
}
public boolean showLightmapTexture() {
return this.minecraft.debugEntries.isOverlayVisible() && this.renderLightmapTexture;
}
public void toggleNetworkCharts() {
this.renderNetworkCharts = !this.minecraft.debugEntries.isOverlayVisible() || !this.renderNetworkCharts;
if (this.renderNetworkCharts) {
this.minecraft.debugEntries.setOverlayVisible(true);
this.renderFpsCharts = false;
this.renderLightmapTexture = false;
}
}
public void toggleFpsCharts() {
this.renderFpsCharts = !this.minecraft.debugEntries.isOverlayVisible() || !this.renderFpsCharts;
if (this.renderFpsCharts) {
this.minecraft.debugEntries.setOverlayVisible(true);
this.renderNetworkCharts = false;
this.renderLightmapTexture = false;
}
}
public void toggleLightmapTexture() {
this.renderLightmapTexture = !this.minecraft.debugEntries.isOverlayVisible() || !this.renderLightmapTexture;
if (this.renderLightmapTexture) {
this.minecraft.debugEntries.setOverlayVisible(true);
this.renderFpsCharts = false;
this.renderNetworkCharts = false;
}
}
public void toggleProfilerChart() {
this.renderProfilerChart = !this.minecraft.debugEntries.isOverlayVisible() || !this.renderProfilerChart;
if (this.renderProfilerChart) {
this.minecraft.debugEntries.setOverlayVisible(true);
}
}
public void logFrameDuration(long frameDuration) {
this.frameTimeLogger.logSample(frameDuration);
}
public LocalSampleLogger getTickTimeLogger() {
return this.tickTimeLogger;
}
public LocalSampleLogger getPingLogger() {
return this.pingLogger;
}
public LocalSampleLogger getBandwidthLogger() {
return this.bandwidthLogger;
}
public ProfilerPieChart getProfilerPieChart() {
return this.profilerPieChart;
}
public void logRemoteSample(long[] sample, RemoteDebugSampleType type) {
LocalSampleLogger logger = this.remoteSupportingLoggers.get(type);
if (logger != null) {
logger.logFullSample(sample);
}
}
public void reset() {
this.tickTimeLogger.reset();
this.pingLogger.reset();
this.bandwidthLogger.reset();
}
public void render3dCrosshair(CameraRenderState cameraState, int guiScale) {
Matrix4fStack modelViewStack = RenderSystem.getModelViewStack();
modelViewStack.pushMatrix();
modelViewStack.translate(0.0F, 0.0F, -1.0F);
modelViewStack.rotateX(cameraState.xRot * (float) (Math.PI / 180.0));
modelViewStack.rotateY(cameraState.yRot * (float) (Math.PI / 180.0));
float crosshairScale = 0.01F * guiScale;
modelViewStack.scale(-crosshairScale, crosshairScale, -crosshairScale);
RenderPipeline renderPipelineOutline = RenderPipelines.LINES;
RenderPipeline renderPipelineFill = RenderPipelines.LINES_DEPTH_BIAS;
RenderTarget mainRenderTarget = Minecraft.getInstance().getMainRenderTarget();
GpuTextureView colorTexture = mainRenderTarget.getColorTextureView();
GpuTextureView depthTexture = mainRenderTarget.getDepthTextureView();
GpuBuffer indexBuffer = this.crosshairIndicies.getBuffer(36);
GpuBufferSlice dynamicTransform = RenderSystem.getDynamicUniforms()
.writeTransform(modelViewStack, new Vector4f(1.0F, 1.0F, 1.0F, 1.0F), new Vector3f(), new Matrix4f());
try (RenderPass renderPass = RenderSystem.getDevice()
.createCommandEncoder()
.createRenderPass(() -> "3d crosshair", colorTexture, OptionalInt.empty(), depthTexture, OptionalDouble.empty())) {
renderPass.setPipeline(renderPipelineOutline);
RenderSystem.bindDefaultUniforms(renderPass);
renderPass.setVertexBuffer(0, this.crosshairBuffer);
renderPass.setIndexBuffer(indexBuffer, this.crosshairIndicies.type());
renderPass.setUniform("DynamicTransforms", dynamicTransform);
renderPass.drawIndexed(0, 0, 18, 1);
renderPass.setPipeline(renderPipelineFill);
renderPass.drawIndexed(0, 18, 18, 1);
}
modelViewStack.popMatrix();
}
}引用的其他类
-
- 引用位置:
字段
- 引用位置:
-
- 引用位置:
字段/方法调用 - 关联成员:
RenderSystem.bindDefaultUniforms(), RenderSystem.getDevice(), RenderSystem.getDynamicUniforms(), RenderSystem.getModelViewStack(), RenderSystem.getSamplerCache(), RenderSystem.getSequentialBuffer()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
BufferBuilder()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
ByteBufferBuilder.exactlySized()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数/字段/方法调用 - 关联成员:
Minecraft.getInstance()
- 引用位置:
-
- 引用位置:
字段
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
DebugScreenDisplayer()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
DebugScreenEntries.getEntry()
- 引用位置:
-
- 引用位置:
字段/构造调用 - 关联成员:
BandwidthDebugChart()
- 引用位置:
-
- 引用位置:
字段/构造调用 - 关联成员:
FpsDebugChart()
- 引用位置:
-
- 引用位置:
字段/构造调用 - 关联成员:
PingDebugChart()
- 引用位置:
-
- 引用位置:
字段/构造调用/返回值 - 关联成员:
ProfilerPieChart()
- 引用位置:
-
- 引用位置:
字段/构造调用 - 关联成员:
TpsDebugChart()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
LevelLoadingScreen.extractChunksForRendering()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
字段/构造调用/返回值 - 关联成员:
LocalSampleLogger()
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
TpsDebugDimensions.values()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Profiler.get()
- 引用位置:
-
- 引用位置:
字段/方法调用 - 关联成员:
ChunkPos.containing()
- 引用位置:
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
字段/返回值
- 引用位置: