LoadingDotsWidget .java

net.minecraft.client.gui.components.LoadingDotsWidget (class): members: Y_PADDING, nextFocusPath, playDownSound, isActive, extractWidgetRenderState, font.

net.minecraft.client.gui.componentsclass53 linesclientextends AbstractWidget1.7 KB

API Surface (4)

void extractWidgetRenderState(final GuiGraphicsExtractor graphics, final int mouseX, final int mouseY, final float a)
void updateWidgetNarration(final NarrationElementOutput output)
void playDownSound(final SoundManager soundManager)
boolean isActive()

Fields & Constants (2)

Y_PADDING
font

Full Source

LoadingDotsWidget.java53 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.gui.components;
2
3
import net.fabricmc.api.EnvType;
4
import net.fabricmc.api.Environment;
5
import net.minecraft.client.gui.ComponentPath;
6
import net.minecraft.client.gui.Font;
7
import net.minecraft.client.gui.GuiGraphicsExtractor;
8
import net.minecraft.client.gui.narration.NarrationElementOutput;
9
import net.minecraft.client.gui.navigation.FocusNavigationEvent;
10
import net.minecraft.client.gui.screens.LoadingDotsText;
11
import net.minecraft.client.sounds.SoundManager;
12
import net.minecraft.network.chat.Component;
13
import net.minecraft.util.Util;
14
import org.jspecify.annotations.Nullable;
15
16
@Environment(EnvType.CLIENT)
17
public class LoadingDotsWidget extends AbstractWidget {
18
	private static final int Y_PADDING = 2;
19
	private final Font font;
20
21
	public LoadingDotsWidget(final Font font, final Component message) {
22
		super(0, 0, font.width(message), 2 + 9 + 6 + 9 + 2, message);
23
		this.font = font;
24
	}
25
26
	@Override
27
	protected void extractWidgetRenderState(final GuiGraphicsExtractor graphics, final int mouseX, final int mouseY, final float a) {
28
		int centerX = this.getX() + this.getWidth() / 2;
29
		Component message = this.getMessage();
30
		graphics.text(this.font, message, centerX - this.font.width(message) / 2, this.getY() + 2, -1);
31
		String dots = LoadingDotsText.get(Util.getMillis());
32
		graphics.text(this.font, dots, centerX - this.font.width(dots) / 2, this.getBottom() - 9 - 2, -8355712);
33
	}
34
35
	@Override
36
	protected void updateWidgetNarration(final NarrationElementOutput output) {
37
	}
38
39
	@Override
40
	public void playDownSound(final SoundManager soundManager) {
41
	}
42
43
	@Override
44
	public boolean isActive() {
45
		return false;
46
	}
47
48
	@Override
49
	public @Nullable ComponentPath nextFocusPath(final FocusNavigationEvent navigationEvent) {
50
		return null;
51
	}
52
}
53

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