DebugEntryFps .java

net.minecraft.client.gui.components.debug.DebugEntryFps (class): members: isAllowed, serverOrClientLevel, displayer, clientChunk, display. imports: Level.

net.minecraft.client.gui.components.debugclass54 linesclient1.7 KB

Implements

API Surface (2)

void display(final DebugScreenDisplayer displayer, final @Nullable Level serverOrClientLevel, final @Nullable LevelChunk clientChunk, final @Nullable LevelChunk serverChunk)
boolean isAllowed(final boolean reducedDebugInfo)

Fields & Constants (3)

displayer
serverOrClientLevel
clientChunk

String literals (4)

" (immediate)"
" (mailbox)"
" (fifo)"
" (fifo relaxed)"

Code Graph: Dependencies (7)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

DebugEntryFps.java54 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.gui.components.debug;
2
3
import com.mojang.blaze3d.platform.VideoMode;
4
import com.mojang.renderpearl.api.device.GpuSurface;
5
import java.util.Locale;
6
import java.util.Optional;
7
import net.fabricmc.api.EnvType;
8
import net.fabricmc.api.Environment;
9
import net.minecraft.client.Minecraft;
10
import net.minecraft.world.level.Level;
11
import net.minecraft.world.level.chunk.LevelChunk;
12
import org.jspecify.annotations.Nullable;
13
14
@Environment(EnvType.CLIENT)
15
public class DebugEntryFps implements DebugScreenEntry {
16
	@Override
17
	public void display(
18
		final DebugScreenDisplayer displayer,
19
		final @Nullable Level serverOrClientLevel,
20
		final @Nullable LevelChunk clientChunk,
21
		final @Nullable LevelChunk serverChunk
22
	) {
23
		Minecraft minecraft = Minecraft.getInstance();
24
		int framerateLimit = minecraft.getFramerateLimitTracker().getFramerateLimit();
25
		Optional<GpuSurface.Configuration> surfaceConfiguration = minecraft.windowSurface().currentConfiguration();
26
		VideoMode activeMode = minecraft.getWindow().getActiveVideoMode();
27
		displayer.addPriorityLine(
28
			String.format(
29
				Locale.ROOT,
30
				"%d fps T: %s%s @%sHz",
31
				minecraft.getFps(),
32
				framerateLimit == 260 ? "inf" : framerateLimit,
33
				presentModeName(surfaceConfiguration.map(GpuSurface.Configuration::presentMode).orElse(null)),
34
				activeMode == null ? "0" : activeMode.refreshRateLabel()
35
			)
36
		);
37
	}
38
39
	@Override
40
	public boolean isAllowed(final boolean reducedDebugInfo) {
41
		return true;
42
	}
43
44
	private static String presentModeName(final GpuSurface.@Nullable PresentMode mode) {
45
		return switch (mode) {
46
			case null -> "";
47
			case IMMEDIATE -> " (immediate)";
48
			case MAILBOX -> " (mailbox)";
49
			case FIFO -> " (fifo)";
50
			case FIFO_RELAXED -> " (fifo relaxed)";
51
		};
52
	}
53
}
54

Decompiled Minecraft 26.3 source of DebugEntryFps (net/minecraft/client/gui/components/debug/DebugEntryFps.java) with Mojang official mappings, stored verbatim on the site.