53 lines
1.6 KiB
Java
53 lines
1.6 KiB
Java
package net.minecraft.client.gui.components;
|
|
|
|
import net.fabricmc.api.EnvType;
|
|
import net.fabricmc.api.Environment;
|
|
import net.minecraft.Util;
|
|
import net.minecraft.client.gui.ComponentPath;
|
|
import net.minecraft.client.gui.Font;
|
|
import net.minecraft.client.gui.GuiGraphics;
|
|
import net.minecraft.client.gui.narration.NarrationElementOutput;
|
|
import net.minecraft.client.gui.navigation.FocusNavigationEvent;
|
|
import net.minecraft.client.gui.screens.LoadingDotsText;
|
|
import net.minecraft.client.sounds.SoundManager;
|
|
import net.minecraft.network.chat.Component;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
@Environment(EnvType.CLIENT)
|
|
public class LoadingDotsWidget extends AbstractWidget {
|
|
private final Font font;
|
|
|
|
public LoadingDotsWidget(Font font, Component message) {
|
|
super(0, 0, font.width(message), 9 * 3, message);
|
|
this.font = font;
|
|
}
|
|
|
|
@Override
|
|
protected void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
|
|
int i = this.getX() + this.getWidth() / 2;
|
|
int j = this.getY() + this.getHeight() / 2;
|
|
Component component = this.getMessage();
|
|
guiGraphics.drawString(this.font, component, i - this.font.width(component) / 2, j - 9, -1);
|
|
String string = LoadingDotsText.get(Util.getMillis());
|
|
guiGraphics.drawString(this.font, string, i - this.font.width(string) / 2, j + 9, -8355712);
|
|
}
|
|
|
|
@Override
|
|
protected void updateWidgetNarration(NarrationElementOutput narrationElementOutput) {
|
|
}
|
|
|
|
@Override
|
|
public void playDownSound(SoundManager handler) {
|
|
}
|
|
|
|
@Override
|
|
public boolean isActive() {
|
|
return false;
|
|
}
|
|
|
|
@Nullable
|
|
@Override
|
|
public ComponentPath nextFocusPath(FocusNavigationEvent event) {
|
|
return null;
|
|
}
|
|
}
|