diff options
author | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2023-11-23 02:15:43 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-23 02:15:43 -0500 |
commit | 1591de0824fe0e7acd5657db79b2977ee7b08437 (patch) | |
tree | b87742f3c4f715f7d9bb9b1d8bcb90840600efff /src/main/java/de | |
parent | 345745c285c85f8fcd2b8fa953de8296056f8054 (diff) | |
parent | 0423d209227d03c94a2410749558621e85eee159 (diff) | |
download | Skyblocker-1591de0824fe0e7acd5657db79b2977ee7b08437.tar.gz Skyblocker-1591de0824fe0e7acd5657db79b2977ee7b08437.tar.bz2 Skyblocker-1591de0824fe0e7acd5657db79b2977ee7b08437.zip |
Merge pull request #423 from AzureAaron/tab-hud-fixes
Fix Garden Tab + Small Things
Diffstat (limited to 'src/main/java/de')
10 files changed, 89 insertions, 40 deletions
diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index 59203269..1c6bb394 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -373,7 +373,7 @@ public class SkyblockerConfig { public static class Hitbox { @SerialEntry - public boolean oldFarmlandHitbox = true; + public boolean oldFarmlandHitbox = false; @SerialEntry public boolean oldLeverHitbox = false; diff --git a/src/main/java/de/hysky/skyblocker/config/categories/MessageFilterCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/MessageFilterCategory.java index f9032c27..c63b933d 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/MessageFilterCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/MessageFilterCategory.java @@ -31,6 +31,7 @@ public class MessageFilterCategory { .build()) .option(Option.<ChatFilterResult>createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.messages.hideAOTE")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.messages.hideAOTE.@Tooltip"))) .binding(defaults.messages.hideAOTE, () -> config.messages.hideAOTE, newValue -> config.messages.hideAOTE = newValue) diff --git a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/util/Ico.java b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/util/Ico.java index 24883d77..82394a78 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/util/Ico.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/util/Ico.java @@ -10,6 +10,7 @@ public class Ico { public static final ItemStack MAP = new ItemStack(Items.FILLED_MAP); public static final ItemStack NTAG = new ItemStack(Items.NAME_TAG); public static final ItemStack EMERALD = new ItemStack(Items.EMERALD); + public static final ItemStack AMETHYST_SHARD = new ItemStack(Items.AMETHYST_SHARD); public static final ItemStack CLOCK = new ItemStack(Items.CLOCK); public static final ItemStack DIASWORD = new ItemStack(Items.DIAMOND_SWORD); public static final ItemStack DBUSH = new ItemStack(Items.DEAD_BUSH); @@ -48,8 +49,10 @@ public class Ico { public static final ItemStack B_ROD = new ItemStack(Items.BLAZE_ROD); public static final ItemStack BOW = new ItemStack(Items.BOW); public static final ItemStack COPPER = new ItemStack(Items.COPPER_INGOT); + public static final ItemStack NETHERITE_UPGRADE_ST = new ItemStack(Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE); public static final ItemStack COMPOSTER = new ItemStack(Items.COMPOSTER); public static final ItemStack SAPLING = new ItemStack(Items.OAK_SAPLING); + public static final ItemStack SEEDS = new ItemStack(Items.WHEAT_SEEDS); public static final ItemStack MILESTONE = new ItemStack(Items.LODESTONE); public static final ItemStack PICKAXE = new ItemStack(Items.IRON_PICKAXE); public static final ItemStack NETHER_STAR = new ItemStack(Items.NETHER_STAR); diff --git a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/ComposterWidget.java b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/ComposterWidget.java index fbeb5ae5..f50b617b 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/ComposterWidget.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/ComposterWidget.java @@ -2,7 +2,7 @@ package de.hysky.skyblocker.skyblock.tabhud.widget; import de.hysky.skyblocker.skyblock.tabhud.util.Ico; - +import de.hysky.skyblocker.skyblock.tabhud.util.PlayerListMgr; import net.minecraft.text.MutableText; import net.minecraft.text.Text; import net.minecraft.util.Formatting; @@ -20,11 +20,11 @@ public class ComposterWidget extends Widget { @Override public void updateContent() { - this.addSimpleIcoText(Ico.SAPLING, "Organic Matter:", Formatting.YELLOW, 48); - this.addSimpleIcoText(Ico.FURNACE, "Fuel:", Formatting.BLUE, 49); - this.addSimpleIcoText(Ico.CLOCK, "Time Left:", Formatting.RED, 50); - this.addSimpleIcoText(Ico.COMPOSTER, "Stored Compost:", Formatting.DARK_GREEN, 51); + int offset = (PlayerListMgr.strAt(46) != null) ? 1 : 0; + this.addSimpleIcoText(Ico.SAPLING, "Organic Matter:", Formatting.YELLOW, 48 + offset); + this.addSimpleIcoText(Ico.FURNACE, "Fuel:", Formatting.BLUE, 49 + offset); + this.addSimpleIcoText(Ico.CLOCK, "Time Left:", Formatting.RED, 50 + offset); + this.addSimpleIcoText(Ico.COMPOSTER, "Stored Compost:", Formatting.DARK_GREEN, 51 + offset); } - } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/GardenServerWidget.java b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/GardenServerWidget.java index 221f8b08..b6b65896 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/GardenServerWidget.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/GardenServerWidget.java @@ -6,7 +6,7 @@ import java.util.regex.Pattern; import de.hysky.skyblocker.skyblock.tabhud.util.Ico; import de.hysky.skyblocker.skyblock.tabhud.util.PlayerListMgr; import de.hysky.skyblocker.skyblock.tabhud.widget.component.IcoTextComponent; - +import de.hysky.skyblocker.utils.Constants; import net.minecraft.text.MutableText; import net.minecraft.text.Text; import net.minecraft.util.Formatting; @@ -14,13 +14,14 @@ import net.minecraft.util.Formatting; // this widget shows info about the garden server public class GardenServerWidget extends Widget { - private static final MutableText TITLE = Text.literal("Server Info").formatted(Formatting.DARK_AQUA, Formatting.BOLD); + //From the armor trim tooltip + private static final int COPPER_COLOR = 11823181; // match the next visitor in the garden // group 1: visitor name - private static final Pattern VISITOR_PATTERN = Pattern.compile("Next Visitor: (?<vis>.*)"); + private static final Pattern VISITOR_PATTERN = Pattern.compile("Visitors: (?<vis>.*)"); public GardenServerWidget() { super(TITLE, Formatting.DARK_AQUA.getColorValue()); @@ -31,17 +32,29 @@ public class GardenServerWidget extends Widget { this.addSimpleIcoText(Ico.MAP, "Area:", Formatting.DARK_AQUA, 41); this.addSimpleIcoText(Ico.NTAG, "Server ID:", Formatting.GRAY, 42); this.addSimpleIcoText(Ico.EMERALD, "Gems:", Formatting.GREEN, 43); - this.addSimpleIcoText(Ico.COPPER, "Copper:", Formatting.GOLD, 44); - Matcher m = PlayerListMgr.regexAt(45, VISITOR_PATTERN); + Text copperText = Widget.simpleEntryText(44, "Copper:", Formatting.WHITE); + ((MutableText) copperText.getSiblings().get(0)).styled(Constants.WITH_COLOR.apply(COPPER_COLOR)); + + this.addComponent(new IcoTextComponent(Ico.COPPER, copperText)); + + boolean hasPesthunterBonus = PlayerListMgr.strAt(46) != null; + + if (hasPesthunterBonus) { + this.addComponent(new IcoTextComponent(Ico.NETHERITE_UPGRADE_ST, PlayerListMgr.textAt(46))); + } + + int offset = hasPesthunterBonus ? 1 : 0; + + Matcher m = PlayerListMgr.regexAt(53 + offset, VISITOR_PATTERN); if (m == null ) { this.addComponent(new IcoTextComponent()); return; } - String vis = m.group("vis"); + String vis = m.group("vis").replaceAll("[()]*", ""); Formatting col; - if (vis.equals("Not Unlocked!")) { + if (vis.equals("Not Unlocked!") || vis.equals("Queue Full!")) { col = Formatting.RED; } else { col = Formatting.GREEN; diff --git a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/GardenSkillsWidget.java b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/GardenSkillsWidget.java index 41eee8d6..75652b33 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/GardenSkillsWidget.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/GardenSkillsWidget.java @@ -26,6 +26,8 @@ public class GardenSkillsWidget extends Widget { private static final Pattern SKILL_PATTERN = Pattern .compile("Skills: (?<skill>[A-Za-z]* [0-9]*): (?<progress>[0-9.MAX]*)%?"); + private static final Pattern GARDEN_LEVEL_PATTERN = Pattern.compile("Garden Level: (?<level>[IVX0-9]+)(?: \\((?<progress>[0-9.]+)% to [IVX0-9]+\\))?"); + // same, more or less private static final Pattern MS_PATTERN = Pattern .compile("Milestone: (?<milestone>[A-Za-z ]* [0-9]*): (?<progress>[0-9.]*)%"); @@ -36,26 +38,46 @@ public class GardenSkillsWidget extends Widget { @Override public void updateContent() { - ProgressComponent pc; - Matcher m = PlayerListMgr.regexAt(66, SKILL_PATTERN); - if (m == null) { - pc = new ProgressComponent(); + ProgressComponent spc; + Matcher skillMatcher = PlayerListMgr.regexAt(66, SKILL_PATTERN); + if (skillMatcher == null) { + spc = new ProgressComponent(); } else { - String strpcnt = m.group("progress"); - String skill = m.group("skill"); + String strpcnt = skillMatcher.group("progress"); + String skill = skillMatcher.group("skill"); if (strpcnt.equals("MAX")) { - pc = new ProgressComponent(Ico.LANTERN, Text.of(skill), Text.of("MAX"), 100f, + spc = new ProgressComponent(Ico.LANTERN, Text.of(skill), Text.of("MAX"), 100f, Formatting.RED.getColorValue()); } else { float pcnt = Float.parseFloat(strpcnt); - pc = new ProgressComponent(Ico.LANTERN, Text.of(skill), pcnt, + spc = new ProgressComponent(Ico.LANTERN, Text.of(skill), pcnt, Formatting.GOLD.getColorValue()); } } - this.addComponent(pc); + this.addComponent(spc); + + ProgressComponent glpc; + Matcher glMatcher = PlayerListMgr.regexAt(45, GARDEN_LEVEL_PATTERN); + + if (glMatcher == null) { + glpc = new ProgressComponent(); + } else { + String level = glMatcher.group("level"); + + if (level.equals("15") || level.equals("XV")) { + glpc = new ProgressComponent(Ico.SEEDS, Text.literal("Garden Level " + level), 100f, Formatting.RED.getColorValue()); + } else { + String strpcnt = glMatcher.group("progress"); + float pcnt = Float.parseFloat(strpcnt); + + glpc = new ProgressComponent(Ico.SEEDS, Text.literal("Garden Level " + level), pcnt, Formatting.DARK_GREEN.getColorValue()); + } + } + + this.addComponent(glpc); Text speed = Widget.simpleEntryText(67, "SPD", Formatting.WHITE); IcoTextComponent spd = new IcoTextComponent(Ico.SUGAR, speed); @@ -66,22 +88,21 @@ public class GardenSkillsWidget extends Widget { tc.addToCell(0, 0, spd); tc.addToCell(1, 0, ffo); this.addComponent(tc); + + this.addComponent(new IcoTextComponent(Ico.HOE, PlayerListMgr.textAt(70))); ProgressComponent pc2; - m = PlayerListMgr.regexAt(69, MS_PATTERN); - if (m == null) { + Matcher milestoneMatcher = PlayerListMgr.regexAt(69, MS_PATTERN); + if (milestoneMatcher == null) { pc2 = new ProgressComponent(); } else { - String strpcnt = m.group("progress"); - String milestone = m.group("milestone"); + String strpcnt = milestoneMatcher.group("progress"); + String milestone = milestoneMatcher.group("milestone"); float pcnt = Float.parseFloat(strpcnt); pc2 = new ProgressComponent(Ico.MILESTONE, Text.of(milestone), pcnt, Formatting.GREEN.getColorValue()); - } this.addComponent(pc2); - } - } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/GardenVisitorsWidget.java b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/GardenVisitorsWidget.java index cfbd6cd0..2b0036ad 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/GardenVisitorsWidget.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/GardenVisitorsWidget.java @@ -15,16 +15,17 @@ public class GardenVisitorsWidget extends Widget { @Override public void updateContent() { - if (PlayerListMgr.textAt(54) == null) { + int offset = (PlayerListMgr.strAt(46) != null) ? 1 : 0; + + if (PlayerListMgr.textAt(54 + offset) == null) { this.addComponent(new PlainTextComponent(Text.literal("No visitors!").formatted(Formatting.GRAY))); return; } - for (int i = 54; i < 59; i++) { + for (int i = 54 + offset; i < 59 + offset; i++) { String text = PlayerListMgr.strAt(i); if (text != null) this.addComponent(new PlainTextComponent(Text.literal(text))); } - } } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/JacobsContestWidget.java b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/JacobsContestWidget.java index 5ae0bd3d..472e6d61 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/JacobsContestWidget.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/JacobsContestWidget.java @@ -1,6 +1,8 @@ package de.hysky.skyblocker.skyblock.tabhud.widget; import java.util.HashMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import de.hysky.skyblocker.skyblock.tabhud.util.Ico; import de.hysky.skyblocker.skyblock.tabhud.util.PlayerListMgr; @@ -19,6 +21,9 @@ public class JacobsContestWidget extends Widget { private static final MutableText TITLE = Text.literal("Jacob's Contest").formatted(Formatting.YELLOW, Formatting.BOLD); + //TODO Properly match the contest placement and display it + private static final Pattern CROP_PATTERN = Pattern.compile("(?:☘|○) (?<crop>[A-Za-z ]+)(?:.+)?"); + private static final HashMap<String, ItemStack> FARM_DATA = new HashMap<>(); // again, there HAS to be a better way to do this @@ -41,22 +46,27 @@ public class JacobsContestWidget extends Widget { @Override public void updateContent() { - this.addSimpleIcoText(Ico.CLOCK, "Starts in:", Formatting.GOLD, 76); + Text jacobStatus = PlayerListMgr.textAt(76); + + if (jacobStatus.getString().equals("ACTIVE")) { + this.addComponent(new IcoTextComponent(Ico.CLOCK, jacobStatus)); + } else { + this.addSimpleIcoText(Ico.CLOCK, "Starts in:", Formatting.GOLD, 76); + } TableComponent tc = new TableComponent(1, 3, Formatting.YELLOW .getColorValue()); for (int i = 77; i < 80; i++) { - String item = PlayerListMgr.strAt(i); + Matcher item = PlayerListMgr.regexAt(i, CROP_PATTERN); IcoTextComponent itc; if (item == null) { itc = new IcoTextComponent(); } else { - itc = new IcoTextComponent(FARM_DATA.get(item), Text.of(item)); + String cropName = item.group("crop").trim(); //Trimming is needed because during a contest the space separator will be caught + itc = new IcoTextComponent(FARM_DATA.get(cropName), Text.of(cropName)); } tc.addToCell(0, i - 77, itc); } this.addComponent(tc); - } - } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/PowderWidget.java b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/PowderWidget.java index 44635fbe..ec176a98 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/PowderWidget.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/PowderWidget.java @@ -22,7 +22,7 @@ public class PowderWidget extends Widget { @Override public void updateContent() { this.addSimpleIcoText(Ico.MITHRIL, "Mithril:", Formatting.AQUA, 46); - this.addSimpleIcoText(Ico.EMERALD, "Gemstone:", Formatting.DARK_PURPLE, 47); + this.addSimpleIcoText(Ico.AMETHYST_SHARD, "Gemstone:", Formatting.DARK_PURPLE, 47); } diff --git a/src/main/java/de/hysky/skyblocker/utils/Constants.java b/src/main/java/de/hysky/skyblocker/utils/Constants.java index e0a5bb5a..134b7888 100644 --- a/src/main/java/de/hysky/skyblocker/utils/Constants.java +++ b/src/main/java/de/hysky/skyblocker/utils/Constants.java @@ -14,7 +14,7 @@ import net.minecraft.util.Formatting; * Holds generic static constants */ public interface Constants { - String LEVEL_EMBLEMS = "\u2E15\u273F\u2741\u2E19\u03B1\u270E\u2615\u2616\u2663\u213B\u2694\u27B6\u26A1\u2604\u269A\u2693\u2620\u269B\u2666\u2660\u2764\u2727\u238A\u1360\u262C\u269D\u29C9\uA214\u32D6\u2E0E\u26A0\uA541\u3020\u30C4\u2948\u2622\u2623\u273E\u269C\u0BD0\u0A6D\u2742\u16C3\u3023\u10F6\u0444\u266A\u266B\u04C3\u26C1\u26C3\u16DD\uA03E\u1C6A\u03A3\u09EB\u2603\u2654\u26C2\u0FC7\u12DE"; + String LEVEL_EMBLEMS = "\u2E15\u273F\u2741\u2E19\u03B1\u270E\u2615\u2616\u2663\u213B\u2694\u27B6\u26A1\u2604\u269A\u2693\u2620\u269B\u2666\u2660\u2764\u2727\u238A\u1360\u262C\u269D\u29C9\uA214\u32D6\u2E0E\u26A0\uA541\u3020\u30C4\u2948\u2622\u2623\u273E\u269C\u0BD0\u0A6D\u2742\u16C3\u3023\u10F6\u0444\u266A\u266B\u04C3\u26C1\u26C3\u16DD\uA03E\u1C6A\u03A3\u09EB\u2603\u2654\u26C2\u0FC7\uA56A\u12DE"; IntFunction<UnaryOperator<Style>> WITH_COLOR = color -> style -> style.withColor(color); Supplier<MutableText> PREFIX = () -> Text.empty() .append(Text.literal("[").formatted(Formatting.GRAY)) |