File size: 1,798 Bytes
d46f4a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package net.minecraft.client.gui.components;

import javax.annotation.Nullable;
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 net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

@OnlyIn(Dist.CLIENT)
public class LoadingDotsWidget extends AbstractWidget {
    private final Font font;

    public LoadingDotsWidget(Font p_299146_, Component p_300579_) {
        super(0, 0, p_299146_.width(p_300579_), 9 * 3, p_300579_);
        this.font = p_299146_;
    }

    @Override
    protected void renderWidget(GuiGraphics p_300747_, int p_298491_, int p_299148_, float p_300011_) {
        int i = this.getX() + this.getWidth() / 2;
        int j = this.getY() + this.getHeight() / 2;
        Component component = this.getMessage();
        p_300747_.drawString(this.font, component, i - this.font.width(component) / 2, j - 9, -1);
        String s = LoadingDotsText.get(Util.getMillis());
        p_300747_.drawString(this.font, s, i - this.font.width(s) / 2, j + 9, -8355712);
    }

    @Override
    protected void updateWidgetNarration(NarrationElementOutput p_300971_) {
    }

    @Override
    public void playDownSound(SoundManager p_310640_) {
    }

    @Override
    public boolean isActive() {
        return false;
    }

    @Nullable
    @Override
    public ComponentPath nextFocusPath(FocusNavigationEvent p_312633_) {
        return null;
    }
}