PingDebugChart .java

net.minecraft.client.gui.components.debugchart.PingDebugChart (class, 38 lines): members: CHART_TOP_VALUE, extractAdditionalLinesAndLabels, getSampleColor.

net.minecraft.client.gui.components.debugchartclass38 linesclientextends AbstractDebugChart1.2 KB

API Surface (4)

void extractAdditionalLinesAndLabels(final GuiGraphicsExtractor graphics, final int left, final int width, final int bottom)
String toDisplayString(final double millis)
int getSampleHeight(final double millis)
int getSampleColor(final long millis)

Fields & Constants (1)

CHART_TOP_VALUE

Code Graph: Dependencies (4)

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

Full Source

PingDebugChart.java38 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.gui.components.debugchart;
2
3
import java.util.Locale;
4
import net.fabricmc.api.EnvType;
5
import net.fabricmc.api.Environment;
6
import net.minecraft.client.gui.Font;
7
import net.minecraft.client.gui.GuiGraphicsExtractor;
8
import net.minecraft.util.debugchart.SampleStorage;
9
10
@Environment(EnvType.CLIENT)
11
public class PingDebugChart extends AbstractDebugChart {
12
	private static final int CHART_TOP_VALUE = 500;
13
14
	public PingDebugChart(final Font font, final SampleStorage sampleStorage) {
15
		super(font, sampleStorage);
16
	}
17
18
	@Override
19
	protected void extractAdditionalLinesAndLabels(final GuiGraphicsExtractor graphics, final int left, final int width, final int bottom) {
20
		this.extractStringWithShade(graphics, "500 ms", left + 1, bottom - 60 + 1);
21
	}
22
23
	@Override
24
	protected String toDisplayString(final double millis) {
25
		return String.format(Locale.ROOT, "%d ms", (int)Math.round(millis));
26
	}
27
28
	@Override
29
	protected int getSampleHeight(final double millis) {
30
		return (int)Math.round(millis * 60.0 / 500.0);
31
	}
32
33
	@Override
34
	protected int getSampleColor(final long millis) {
35
		return this.getSampleColor(millis, 0.0, -16711936, 250.0, -256, 500.0, -65536);
36
	}
37
}
38

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