aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/ErrorWidget.java
blob: 85019dbf664d7e13278b1d5d744c83ce208e826a (plain)
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
package de.hysky.skyblocker.skyblock.tabhud.widget;

import de.hysky.skyblocker.skyblock.tabhud.widget.component.PlainTextComponent;

import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;

// empty widget for when nothing can be shown

public class ErrorWidget extends Widget {
    private static final MutableText TITLE = Text.literal("Error").formatted(Formatting.RED,
            Formatting.BOLD);

    Text error = Text.of("No info available!");

    public ErrorWidget() {
        super(TITLE, Formatting.RED.getColorValue());
    }

    public ErrorWidget(String error) {
        super(TITLE, Formatting.RED.getColorValue());
        this.error = Text.of(error);
    }

    @Override
    public void updateContent() {
        PlainTextComponent inf = new PlainTextComponent(this.error);
        this.addComponent(inf);
    }

}