From 7ee6a9100aff91179e837d00a9bcee607a20ca63 Mon Sep 17 00:00:00 2001 From: msg-programs Date: Sun, 3 Sep 2023 10:44:34 +0200 Subject: Add missing widget docs and widgets --- src/main/resources/assets/skyblocker/tabhud/readme.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main/resources/assets/skyblocker/tabhud/readme.md b/src/main/resources/assets/skyblocker/tabhud/readme.md index a50c1f96..70702d9c 100644 --- a/src/main/resources/assets/skyblocker/tabhud/readme.md +++ b/src/main/resources/assets/skyblocker/tabhud/readme.md @@ -68,6 +68,7 @@ Grouped by themes (roughly) - SkillsWidget: The player's skill levels and stats - TrapperWidget: Trapper pelts on the farming island. - UpgradeWidget: Currently running upgrades +- CameraPositionWidget: Shows orientation (pitch/yaw) of camera #### Garden - ComposterWidget: The composter in the garden. @@ -96,12 +97,12 @@ Grouped by themes (roughly) #### Rift - AdvertisementWidget: Shows rift ads. -- GoodToKnowWidget: -- RiftProfileWidget: -- RiftProgressWidget: +- GoodToKnowWidget: Lifetime Motes earned and/or times you visited the rift. +- RiftProfileWidget: Info about your player profile while in the rift. +- RiftProgressWidget: Info about Montezuma, Timecharms and Enigma Souls. - RiftServerInfoWidget: Server widget specialized for the rift. - RiftStatsWidget: Server widget specialized for the rift. -- ShenWidget: +- ShenWidget: Shows Shen's countdown #### Player lists - PlayerListWidget: Generic list of players in the area. -- cgit From af8a95bb8f3cb8c53959fc51c8208b10093a3a27 Mon Sep 17 00:00:00 2001 From: msg-programs Date: Sun, 3 Sep 2023 10:45:04 +0200 Subject: Remove whitespace on empty lines --- .../skyblock/tabhud/widget/rift/RiftProfileWidget.java | 4 ++-- .../skyblock/tabhud/widget/rift/RiftServerInfoWidget.java | 2 +- .../skyblock/tabhud/widget/rift/RiftStatsWidget.java | 10 +++++----- .../skyblocker/skyblock/tabhud/widget/rift/ShenWidget.java | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProfileWidget.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProfileWidget.java index 0b6ff5bf..785850d5 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProfileWidget.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProfileWidget.java @@ -7,9 +7,9 @@ import net.minecraft.text.Text; import net.minecraft.util.Formatting; public class RiftProfileWidget extends Widget { - + private static final MutableText TITLE = Text.literal("Profile").formatted(Formatting.DARK_AQUA, Formatting.BOLD); - + public RiftProfileWidget() { super(TITLE, Formatting.DARK_AQUA.getColorValue()); } diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftServerInfoWidget.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftServerInfoWidget.java index cab38a86..1ec3771e 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftServerInfoWidget.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftServerInfoWidget.java @@ -11,7 +11,7 @@ import net.minecraft.util.Formatting; * */ public class RiftServerInfoWidget extends Widget { - + private static final MutableText TITLE = Text.literal("Server Info").formatted(Formatting.LIGHT_PURPLE, Formatting.BOLD); public RiftServerInfoWidget() { diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftStatsWidget.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftStatsWidget.java index 8fab3dd4..95a587a9 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftStatsWidget.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftStatsWidget.java @@ -21,22 +21,22 @@ public class RiftStatsWidget extends Widget { public void updateContent() { Text riftDamage = Widget.simpleEntryText(64, "RDG", Formatting.DARK_PURPLE); IcoTextComponent rdg = new IcoTextComponent(Ico.DIASWORD, riftDamage); - + Text speed = Widget.simpleEntryText(65, "SPD", Formatting.WHITE); IcoTextComponent spd = new IcoTextComponent(Ico.SUGAR, speed); - + Text intelligence = Widget.simpleEntryText(66, "INT", Formatting.AQUA); IcoTextComponent intel = new IcoTextComponent(Ico.ENCHANTED_BOOK, intelligence); - + Text manaRegen = Widget.simpleEntryText(67, "MRG", Formatting.AQUA); IcoTextComponent mrg = new IcoTextComponent(Ico.DIAMOND, manaRegen); - + TableComponent tc = new TableComponent(2, 2, Formatting.AQUA.getColorValue()); tc.addToCell(0, 0, rdg); tc.addToCell(0, 1, spd); tc.addToCell(1, 0, intel); tc.addToCell(1, 1, mrg); - + this.addComponent(tc); } diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/ShenWidget.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/ShenWidget.java index a1345c49..1f432406 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/ShenWidget.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/ShenWidget.java @@ -8,7 +8,7 @@ import net.minecraft.text.Text; import net.minecraft.util.Formatting; public class ShenWidget extends Widget { - + private static final MutableText TITLE = Text.literal("Shen's Countdown").formatted(Formatting.DARK_AQUA, Formatting.BOLD); public ShenWidget() { -- cgit From c916d2020fcb9ead7a6e23f218e34627d02b0680 Mon Sep 17 00:00:00 2001 From: msg-programs Date: Sun, 3 Sep 2023 10:46:28 +0200 Subject: Fix bugs that cause crashes when the text at some position is null. --- .../skyblock/tabhud/widget/rift/GoodToKnowWidget.java | 12 ++++++------ .../skyblock/tabhud/widget/rift/RiftProgressWidget.java | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/GoodToKnowWidget.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/GoodToKnowWidget.java index e3b462a9..841b3e32 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/GoodToKnowWidget.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/GoodToKnowWidget.java @@ -31,17 +31,17 @@ public class GoodToKnowWidget extends Widget { // Check each position to see what is or isn't there so we don't try adding // invalid components - if (pos49.getString().contains("times")) + if (pos49 != null && pos49.getString().contains("times")) visitedRiftPos = 49; - if (pos51.getString().contains("Motes")) + if (pos51 != null && pos51.getString().contains("Motes")) lifetimeMotesPos = 51; - if (pos51.getString().contains("times")) + if (pos51 != null && pos51.getString().contains("times")) visitedRiftPos = 51; - if (pos53.getString().contains("Motes")) + if (pos53 != null && pos53.getString().contains("Motes")) lifetimeMotesPos = 53; - Text timesVisitedRift = (visitedRiftPos == 51) ? pos51 : (visitedRiftPos == 49) ? pos49 : null; - Text lifetimeMotesEarned = (lifetimeMotesPos == 53) ? pos53 : (lifetimeMotesPos == 51) ? pos51 : null; + Text timesVisitedRift = (visitedRiftPos == 51) ? pos51 : (visitedRiftPos == 49) ? pos49 : Text.of("No Data"); + Text lifetimeMotesEarned = (lifetimeMotesPos == 53) ? pos53 : (lifetimeMotesPos == 51) ? pos51 : Text.of("No Data"); if (visitedRiftPos != 0) { this.addComponent(new IcoTextComponent(Ico.EXPERIENCE_BOTTLE, diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProgressWidget.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProgressWidget.java index 375a41b9..8ba6eece 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProgressWidget.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProgressWidget.java @@ -40,9 +40,9 @@ public class RiftProgressWidget extends Widget { // Check each position to see what is or isn't there so we don't try adding // invalid components - if (pos45.contains("Timecharms")) + if (pos45 != null && pos45.contains("Timecharms")) hasTimecharms = true; - if (pos46.contains("Enigma Souls")) + if (pos46 != null && pos46.contains("Enigma Souls")) hasEnigmaSouls = true; // Small ternary to account for positions, defaults to -1 if it for some reason -- cgit From c342f496cd4999a0a5a18cc4879c942e95a5ebf7 Mon Sep 17 00:00:00 2001 From: msg-programs Date: Tue, 5 Sep 2023 10:27:12 +0200 Subject: Show "No Ads" message if there's no ad --- .../skyblock/tabhud/widget/rift/AdvertisementWidget.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/AdvertisementWidget.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/AdvertisementWidget.java index 88e3a5cd..8d50fc2f 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/AdvertisementWidget.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/AdvertisementWidget.java @@ -18,12 +18,18 @@ public class AdvertisementWidget extends Widget { @Override public void updateContent() { + boolean added = false; for (int i = 73; i < 80; i++) { Text text = PlayerListMgr.textAt(i); - if (text != null) + if (text != null) { this.addComponent(new PlainTextComponent(text)); + added = true; + } } + if (!added) { + this.addComponent(new PlainTextComponent(Text.literal("No Advertisements").formatted(Formatting.GRAY))); + } } } -- cgit From f1c7b2e66ae2c5c5bda8bcd6645636fe677dec48 Mon Sep 17 00:00:00 2001 From: msg-programs Date: Tue, 5 Sep 2023 10:45:22 +0200 Subject: Show a "No Progress" text when no progress has been made yet --- .../skyblock/tabhud/widget/rift/RiftProgressWidget.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProgressWidget.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProgressWidget.java index 8ba6eece..bfd52131 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProgressWidget.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProgressWidget.java @@ -6,6 +6,7 @@ import java.util.regex.Pattern; import me.xmrvizzy.skyblocker.skyblock.tabhud.util.Ico; import me.xmrvizzy.skyblocker.skyblock.tabhud.util.PlayerListMgr; import me.xmrvizzy.skyblocker.skyblock.tabhud.widget.Widget; +import me.xmrvizzy.skyblocker.skyblock.tabhud.widget.component.PlainTextComponent; import me.xmrvizzy.skyblocker.skyblock.tabhud.widget.component.ProgressComponent; import net.minecraft.text.MutableText; import net.minecraft.text.Text; @@ -30,6 +31,14 @@ public class RiftProgressWidget extends Widget { // that // In beginning it only shows montezuma, then timecharms and enigma souls are // added + String pos44 = PlayerListMgr.strAt(45); + + // LHS short-circuits, so the RHS won't be evaluated on pos44 == null + if (pos44 == null || !pos44.contains("Rift Progress")) { + this.addComponent(new PlainTextComponent(Text.literal("No Progress").formatted(Formatting.GRAY))); + return; + } + String pos45 = PlayerListMgr.strAt(45); // Can be Montezuma or Timecharms String pos46 = PlayerListMgr.strAt(46); // Can be Enigma Souls or Empty String pos47 = PlayerListMgr.strAt(47); // Can be Montezuma or "Good to know" heading -- cgit From dacf2f5b5df0c6fa7a5f04243e269b3ed80ae6b7 Mon Sep 17 00:00:00 2001 From: msg-programs Date: Tue, 5 Sep 2023 10:46:19 +0200 Subject: Search for header instead of assuming it's position to fix issues when no progress has been made --- .../tabhud/widget/rift/GoodToKnowWidget.java | 40 ++++++++++++++-------- 1 file changed, 26 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/GoodToKnowWidget.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/GoodToKnowWidget.java index 841b3e32..d1a3df1f 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/GoodToKnowWidget.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/GoodToKnowWidget.java @@ -22,26 +22,38 @@ public class GoodToKnowWidget extends Widget { // that // In beginning it only shows montezuma, then timecharms and enigma souls are // added - Text pos49 = PlayerListMgr.textAt(49); // Can be times visited rift - Text pos51 = PlayerListMgr.textAt(51); // Can be lifetime motes or visited rift - Text pos53 = PlayerListMgr.textAt(53); // Can be lifetime motes + + int headerPos = 0; + // this seems suboptimal, but I'm not sure if there's a way to do it better. + // search for the GTK header and offset the rest accordingly. + for (int i = 45; i <= 49; i++) { + String str = PlayerListMgr.strAt(i); + if (str != null && str.startsWith("Good to")) { + headerPos = i; + break; + } + } + + Text posA = PlayerListMgr.textAt(headerPos + 2); // Can be times visited rift + Text posB = PlayerListMgr.textAt(headerPos + 4); // Can be lifetime motes or visited rift + Text posC = PlayerListMgr.textAt(headerPos + 6); // Can be lifetime motes int visitedRiftPos = 0; int lifetimeMotesPos = 0; // Check each position to see what is or isn't there so we don't try adding // invalid components - if (pos49 != null && pos49.getString().contains("times")) - visitedRiftPos = 49; - if (pos51 != null && pos51.getString().contains("Motes")) - lifetimeMotesPos = 51; - if (pos51 != null && pos51.getString().contains("times")) - visitedRiftPos = 51; - if (pos53 != null && pos53.getString().contains("Motes")) - lifetimeMotesPos = 53; - - Text timesVisitedRift = (visitedRiftPos == 51) ? pos51 : (visitedRiftPos == 49) ? pos49 : Text.of("No Data"); - Text lifetimeMotesEarned = (lifetimeMotesPos == 53) ? pos53 : (lifetimeMotesPos == 51) ? pos51 : Text.of("No Data"); + if (posA != null && posA.getString().contains("times")) + visitedRiftPos = headerPos + 2; + if (posB != null && posB.getString().contains("Motes")) + lifetimeMotesPos = headerPos + 4; + if (posB != null && posB.getString().contains("times")) + visitedRiftPos = headerPos + 4; + if (posC != null && posC.getString().contains("Motes")) + lifetimeMotesPos = headerPos + 6; + + Text timesVisitedRift = (visitedRiftPos == headerPos + 4) ? posB : (visitedRiftPos == headerPos + 2) ? posA : Text.literal("No Data").formatted(Formatting.GRAY); + Text lifetimeMotesEarned = (lifetimeMotesPos == headerPos + 6) ? posC : (lifetimeMotesPos == headerPos + 4) ? posB : Text.literal("No Data").formatted(Formatting.GRAY); if (visitedRiftPos != 0) { this.addComponent(new IcoTextComponent(Ico.EXPERIENCE_BOTTLE, -- cgit From 2a0cfe9c7cd81b7e086f9902b0ee7a4affb3b89c Mon Sep 17 00:00:00 2001 From: msg-programs Date: Thu, 7 Sep 2023 10:23:35 +0200 Subject: Prevent null pointer exception on missing footer --- .../me/xmrvizzy/skyblocker/skyblock/tabhud/util/PlayerListMgr.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/util/PlayerListMgr.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/util/PlayerListMgr.java index 7b35bcce..446b7d81 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/util/PlayerListMgr.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/util/PlayerListMgr.java @@ -43,7 +43,11 @@ public class PlayerListMgr { } public static void updateFooter(Text f) { - footer = f.getString(); + if (f == null) { + footer = null; + } else { + footer = f.getString(); + } } public static String getFooter() { -- cgit From b153e75818b5058df9334953d5924c2c82598719 Mon Sep 17 00:00:00 2001 From: msg-programs Date: Fri, 8 Sep 2023 09:54:36 +0200 Subject: Rewrite the RiftProgressWidget, hopefully it works correctly now. --- .../tabhud/widget/rift/RiftProgressWidget.java | 135 ++++++++++++--------- 1 file changed, 75 insertions(+), 60 deletions(-) (limited to 'src') diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProgressWidget.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProgressWidget.java index bfd52131..ad43c9f4 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProgressWidget.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProgressWidget.java @@ -15,23 +15,24 @@ import net.minecraft.util.math.MathHelper; public class RiftProgressWidget extends Widget { - private static final MutableText TITLE = Text.literal("Rift Progress").formatted(Formatting.BLUE, Formatting.BOLD); + private static final MutableText TITLE = Text.literal("Rift Progress").formatted(Formatting.BLUE, Formatting.BOLD); - private static final Pattern TIMECHARMS_PATTERN = Pattern.compile("Timecharms: (?[0-9]+)\\/(?[0-9]+)"); - private static final Pattern ENIGMA_SOULS_PATTERN = Pattern.compile("Enigma Souls: (?[0-9]+)\\/(?[0-9]+)"); - private static final Pattern MONTEZUMA_PATTERN = Pattern.compile("Montezuma: (?[0-9]+)\\/(?[0-9]+)"); + private static final Pattern TIMECHARMS_PATTERN = Pattern.compile("Timecharms: (?[0-9]+)\\/(?[0-9]+)"); + private static final Pattern ENIGMA_SOULS_PATTERN = Pattern.compile("Enigma Souls: (?[0-9]+)\\/(?[0-9]+)"); + private static final Pattern MONTEZUMA_PATTERN = Pattern.compile("Montezuma: (?[0-9]+)\\/(?[0-9]+)"); - public RiftProgressWidget() { - super(TITLE, Formatting.BLUE.getColorValue()); + public RiftProgressWidget() { + super(TITLE, Formatting.BLUE.getColorValue()); } @Override public void updateContent() { - // After you progress further the tab adds more info so we need to be careful of - // that - // In beginning it only shows montezuma, then timecharms and enigma souls are - // added - String pos44 = PlayerListMgr.strAt(45); + // After you progress further, the tab adds more info so we need to be careful + // of that. + // In beginning it only shows montezuma, then timecharms and enigma souls are + // added. + + String pos44 = PlayerListMgr.strAt(44); // LHS short-circuits, so the RHS won't be evaluated on pos44 == null if (pos44 == null || !pos44.contains("Rift Progress")) { @@ -39,70 +40,84 @@ public class RiftProgressWidget extends Widget { return; } - String pos45 = PlayerListMgr.strAt(45); // Can be Montezuma or Timecharms - String pos46 = PlayerListMgr.strAt(46); // Can be Enigma Souls or Empty - String pos47 = PlayerListMgr.strAt(47); // Can be Montezuma or "Good to know" heading + // let's try to be clever by assuming what progress item may appear where and + // when to skip testing every slot for every thing. - boolean hasTimecharms = false; - boolean hasEnigmaSouls = false; - int montezumaPos; + // always non-null, as this holds the topmost item. + // if there is none, there shouldn't be a header. + String pos45 = PlayerListMgr.strAt(45); - // Check each position to see what is or isn't there so we don't try adding - // invalid components - if (pos45 != null && pos45.contains("Timecharms")) - hasTimecharms = true; - if (pos46 != null && pos46.contains("Enigma Souls")) - hasEnigmaSouls = true; + // Can be Montezuma, Enigma Souls or Timecharms. + // assume timecharms can only appear here and that they're the last thing to + // appear, so if this exists, we know the rest. + if (pos45.contains("Timecharms")) { + addTimecharmsComponent(45); + addEnigmaSoulsComponent(46); + addMontezumaComponent(47); + return; + } - // Small ternary to account for positions, defaults to -1 if it for some reason - // does not exist (which shouldn't be the case!) - montezumaPos = (pos47.contains("Montezuma")) ? 47 : (pos45.contains("Montezuma")) ? 45 : -1; + // timecharms didn't appear at the top, so there's two or one entries. + // assume that if there's two, souls is always top. + String pos46 = PlayerListMgr.strAt(46); + + if (pos45.contains("Enigma Souls")) { + addEnigmaSoulsComponent(45); + if (pos46 != null) { + // souls might appear alone. + // if there's a second entry, it has to be montezuma + addMontezumaComponent(46); + } + } else { + // first entry isn't souls, so it's just montezuma and nothing else. + addMontezumaComponent(45); + } - if (hasTimecharms) { - Matcher m = PlayerListMgr.regexAt(45, TIMECHARMS_PATTERN); + } - int current = Integer.parseInt(m.group("current")); - int total = Integer.parseInt(m.group("total")); - float pcnt = ((float) current / (float) total) * 100f; - Text progressText = Text.literal(current + "/" + total); + private static int pcntToCol(float pcnt) { + return MathHelper.hsvToRgb(pcnt / 300f, 0.9f, 0.9f); + } - ProgressComponent pc = new ProgressComponent(Ico.NETHER_STAR, Text.literal("Timecharms"), progressText, - pcnt, pcntToCol(pcnt)); + private void addTimecharmsComponent(int pos) { + Matcher m = PlayerListMgr.regexAt(pos, TIMECHARMS_PATTERN); - this.addComponent(pc); - } + int current = Integer.parseInt(m.group("current")); + int total = Integer.parseInt(m.group("total")); + float pcnt = ((float) current / (float) total) * 100f; + Text progressText = Text.literal(current + "/" + total); - if (hasEnigmaSouls) { - Matcher m = PlayerListMgr.regexAt(46, ENIGMA_SOULS_PATTERN); + ProgressComponent pc = new ProgressComponent(Ico.NETHER_STAR, Text.literal("Timecharms"), progressText, + pcnt, pcntToCol(pcnt)); - int current = Integer.parseInt(m.group("current")); - int total = Integer.parseInt(m.group("total")); - float pcnt = ((float) current / (float) total) * 100f; - Text progressText = Text.literal(current + "/" + total); + this.addComponent(pc); + } - ProgressComponent pc = new ProgressComponent(Ico.HEART_OF_THE_SEA, Text.literal("Enigma Souls"), - progressText, pcnt, pcntToCol(pcnt)); + private void addEnigmaSoulsComponent(int pos) { + Matcher m = PlayerListMgr.regexAt(pos, ENIGMA_SOULS_PATTERN); - this.addComponent(pc); - } + int current = Integer.parseInt(m.group("current")); + int total = Integer.parseInt(m.group("total")); + float pcnt = ((float) current / (float) total) * 100f; + Text progressText = Text.literal(current + "/" + total); - if (montezumaPos != -1) { - Matcher m = PlayerListMgr.regexAt(montezumaPos, MONTEZUMA_PATTERN); + ProgressComponent pc = new ProgressComponent(Ico.HEART_OF_THE_SEA, Text.literal("Enigma Souls"), + progressText, pcnt, pcntToCol(pcnt)); - int current = Integer.parseInt(m.group("current")); - int total = Integer.parseInt(m.group("total")); - float pcnt = ((float) current / (float) total) * 100f; - Text progressText = Text.literal(current + "/" + total); + this.addComponent(pc); + } - ProgressComponent pc = new ProgressComponent(Ico.BONE, Text.literal("Montezuma"), progressText, pcnt, - pcntToCol(pcnt)); + private void addMontezumaComponent(int pos) { + Matcher m = PlayerListMgr.regexAt(pos, MONTEZUMA_PATTERN); - this.addComponent(pc); - } + int current = Integer.parseInt(m.group("current")); + int total = Integer.parseInt(m.group("total")); + float pcnt = ((float) current / (float) total) * 100f; + Text progressText = Text.literal(current + "/" + total); - } + ProgressComponent pc = new ProgressComponent(Ico.BONE, Text.literal("Montezuma"), progressText, pcnt, + pcntToCol(pcnt)); - private static int pcntToCol(float pcnt) { - return MathHelper.hsvToRgb(pcnt / 300f, 0.9f, 0.9f); - } + this.addComponent(pc); + } } -- cgit