diff options
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java index e3e0802c..26919bd2 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java @@ -24,7 +24,7 @@ import java.util.stream.Stream; public class DwarvenHud { - private static final MinecraftClient client = MinecraftClient.getInstance(); + private static final MinecraftClient CLIENT = MinecraftClient.getInstance(); private static List<Commission> commissionList = new ArrayList<>(); public static String mithrilPowder = "0"; @@ -33,18 +33,20 @@ public class DwarvenHud { private static final List<Pattern> COMMISSIONS = Stream.of( "(?:Titanium|Mithril|Hard Stone) Miner", - "(?:Ice Walker|Golden Goblin|(?<!Golden )Goblin|Goblin Raid|Automaton|Sludge|Team Treasurite Member|Yog|Boss Corleone|Thyst) Slayer", + "(?:Ice Walker|Golden Goblin|(?<!Golden )Goblin|Goblin Raid|Treasure Hoarder|Automaton|Sludge|Team Treasurite Member|Yog|Boss Corleone|Thyst) Slayer", "(?:Lava Springs|Cliffside Veins|Rampart's Quarry|Upper Mines|Royal Mines) Mithril", "(?:Lava Springs|Cliffside Veins|Rampart's Quarry|Upper Mines|Royal Mines) Titanium", "Goblin Raid", - "(?:Powder Ghast|Star Sentry|Treasure Hoarder) Puncher", + "(?:Star Sentry|Treasure Hoarder) Puncher", "(?<!Lucky )Raffle", "Lucky Raffle", "2x Mithril Powder Collector", "First Event", "(?:Ruby|Amber|Sapphire|Jade|Amethyst|Topaz) Gemstone Collector", "(?:Amber|Sapphire|Jade|Amethyst|Topaz) Crystal Hunter", - "Chest Looter").map(s -> Pattern.compile("(" + s + "): (\\d+\\.?\\d*%|DONE)") + "(?:Umber|Tungsten|Glacite|Scrap) Collector", + "Mineshaft Explorer", + "(?:Chest|Corpse) Looter").map(s -> Pattern.compile("(" + s + "): (\\d+\\.?\\d*%|DONE)") ).collect(Collectors.toList()); private static final Pattern MITHRIL_PATTERN = Pattern.compile("Mithril: [0-9,]+"); private static final Pattern GEMSTONE_PATTERN = Pattern.compile("Gemstone: [0-9,]+"); @@ -61,8 +63,8 @@ public class DwarvenHud { HudRenderCallback.EVENT.register((context, tickDelta) -> { if (!SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.enabledCommissions && !SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.enabledPowder - || client.options.playerListKey.isPressed() - || client.player == null + || CLIENT.options.playerListKey.isPressed() + || CLIENT.player == null || (!Utils.isInDwarvenMines() && !Utils.isInCrystalHollows())) { return; } @@ -76,7 +78,7 @@ public class DwarvenHud { }); } - public static void render(HudCommsWidget hcw, HudPowderWidget hpw, DrawContext context, int comHudX, int comHudY, int powderHudX, int powderHudY, List<Commission> commissions) { + protected static void render(HudCommsWidget hcw, HudPowderWidget hpw, DrawContext context, int comHudX, int comHudY, int powderHudX, int powderHudY, List<Commission> commissions) { switch (SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.style) { case SIMPLE -> renderSimple(hcw, hpw, context, comHudX, comHudY, powderHudX, powderHudY, commissions); case FANCY -> renderFancy(hcw, hpw, context, comHudX, comHudY, powderHudX, powderHudY, commissions); @@ -93,7 +95,7 @@ public class DwarvenHud { * @param powderHudY Y coordinate of the powder hud * @param commissions the commissions to render to the commissions hud */ - public static void renderClassic(DrawContext context, int comHudX, int comHudY, int powderHudX, int powderHudY, List<Commission> commissions) { + private static void renderClassic(DrawContext context, int comHudX, int comHudY, int powderHudX, int powderHudY, List<Commission> commissions) { if (SkyblockerConfigManager.get().general.tabHud.enableHudBackground) { context.fill(comHudX, comHudY, comHudX + 200, comHudY + (20 * commissions.size()), 0x64000000); context.fill(powderHudX, powderHudY, powderHudX + 200, powderHudY + 40, 0x64000000); @@ -108,7 +110,7 @@ public class DwarvenHud { percentage = 100f; } - context.drawTextWithShadow(client.textRenderer, + context.drawTextWithShadow(CLIENT.textRenderer, Text.literal(commission.commission + ": ").formatted(Formatting.AQUA) .append(Text.literal(commission.progression).formatted(Colors.hypixelProgressColor(percentage))), comHudX + 5, comHudY + y + 5, 0xFFFFFFFF); @@ -117,16 +119,16 @@ public class DwarvenHud { } if (SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.enabledPowder) { //render mithril powder then gemstone - context.drawTextWithShadow(client.textRenderer, + context.drawTextWithShadow(CLIENT.textRenderer, Text.literal("Mithril: " + mithrilPowder).formatted(Formatting.AQUA), powderHudX + 5, powderHudY + 5, 0xFFFFFFFF); - context.drawTextWithShadow(client.textRenderer, + context.drawTextWithShadow(CLIENT.textRenderer, Text.literal("Gemstone: " + gemStonePowder).formatted(Formatting.DARK_PURPLE), powderHudX + 5, powderHudY + 25, 0xFFFFFFFF); } } - public static void renderSimple(HudCommsWidget hcw, HudPowderWidget hpw, DrawContext context, int comHudX, int comHudY, int powderHudX, int powderHudY, List<Commission> commissions) { + private static void renderSimple(HudCommsWidget hcw, HudPowderWidget hpw, DrawContext context, int comHudX, int comHudY, int powderHudX, int powderHudY, List<Commission> commissions) { if (SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.enabledCommissions) { hcw.updateData(commissions, false); hcw.update(); @@ -142,7 +144,7 @@ public class DwarvenHud { } } - public static void renderFancy(HudCommsWidget hcw, HudPowderWidget hpw, DrawContext context, int comHudX, int comHudY, int powderHudX, int powderHudY, List<Commission> commissions) { + private static void renderFancy(HudCommsWidget hcw, HudPowderWidget hpw, DrawContext context, int comHudX, int comHudY, int powderHudX, int powderHudY, List<Commission> commissions) { if (SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.enabledCommissions) { hcw.updateData(commissions, true); hcw.update(); @@ -159,7 +161,7 @@ public class DwarvenHud { } public static void update() { - if (client.player == null || client.getNetworkHandler() == null + if (CLIENT.player == null || CLIENT.getNetworkHandler() == null || !SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.enabledCommissions && !SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.enabledPowder || !Utils.isInCrystalHollows() && !Utils.isInDwarvenMines()) { return; @@ -167,7 +169,7 @@ public class DwarvenHud { commissionList = new ArrayList<>(); - for (PlayerListEntry playerListEntry : client.getNetworkHandler().getPlayerList()) { + for (PlayerListEntry playerListEntry : CLIENT.getNetworkHandler().getPlayerList()) { if (playerListEntry.getDisplayName() == null) { continue; } |