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
54
55
56
57
58
59
|
package de.hysky.skyblocker.skyblock.tabhud.widget;
import java.util.HashMap;
import de.hysky.skyblocker.skyblock.tabhud.util.PlayerListMgr;
import de.hysky.skyblocker.skyblock.tabhud.widget.component.IcoTextComponent;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Pair;
// shows the volcano status (crimson isle)
public class VolcanoWidget extends Widget {
private static final MutableText TITLE = Text.literal("Volcano Status").formatted(Formatting.AQUA,
Formatting.BOLD);
private static final HashMap<String, Pair<ItemStack, Formatting>> BOOM_TYPE = new HashMap<>();
static {
BOOM_TYPE.put("INACTIVE",
new Pair<>(new ItemStack(Items.BARRIER), Formatting.DARK_GRAY));
BOOM_TYPE.put("CHILL",
new Pair<>(new ItemStack(Items.ICE), Formatting.AQUA));
BOOM_TYPE.put("LOW",
new Pair<>(new ItemStack(Items.FLINT_AND_STEEL), Formatting.GRAY));
BOOM_TYPE.put("DISRUPTIVE",
new Pair<>(new ItemStack(Items.CAMPFIRE), Formatting.WHITE));
BOOM_TYPE.put("MEDIUM",
new Pair<>(new ItemStack(Items.LAVA_BUCKET), Formatting.YELLOW));
BOOM_TYPE.put("HIGH",
new Pair<>(new ItemStack(Items.FIRE_CHARGE), Formatting.GOLD));
BOOM_TYPE.put("EXPLOSIVE",
new Pair<>(new ItemStack(Items.TNT), Formatting.RED));
BOOM_TYPE.put("CATACLYSMIC",
new Pair<>(new ItemStack(Items.SKELETON_SKULL), Formatting.DARK_RED));
}
public VolcanoWidget() {
super(TITLE, Formatting.AQUA.getColorValue());
}
@Override
public void updateContent() {
String s = PlayerListMgr.strAt(58);
if (s == null) {
this.addComponent(new IcoTextComponent());
} else {
Pair<ItemStack, Formatting> p = BOOM_TYPE.get(s);
this.addComponent(new IcoTextComponent(p.getLeft(), Text.literal(s).formatted(p.getRight())));
}
}
}
|