2025-11-24 22:52:51 +03:00

41 lines
1.2 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package net.minecraft.client.gui.components.debugchart;
import java.util.Locale;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.debugchart.AbstractDebugChart;
import net.minecraft.util.debugchart.SampleStorage;
public class PingDebugChart
extends AbstractDebugChart {
private static final int CHART_TOP_VALUE = 500;
public PingDebugChart(Font font, SampleStorage sampleStorage) {
super(font, sampleStorage);
}
@Override
protected void renderAdditionalLinesAndLabels(GuiGraphics graphics, int left, int width, int bottom) {
this.drawStringWithShade(graphics, "500 ms", left + 1, bottom - 60 + 1);
}
@Override
protected String toDisplayString(double millis) {
return String.format(Locale.ROOT, "%d ms", (int)Math.round(millis));
}
@Override
protected int getSampleHeight(double millis) {
return (int)Math.round(millis * 60.0 / 500.0);
}
@Override
protected int getSampleColor(long millis) {
return this.getSampleColor(millis, 0.0, -16711936, 250.0, -256, 500.0, -65536);
}
}