diff options
Diffstat (limited to 'src/main/java/me/xmrvizzy/skyblocker/skyblock/dwarven')
4 files changed, 0 insertions, 303 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dwarven/DwarvenHud.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dwarven/DwarvenHud.java deleted file mode 100644 index 3d8292a5..00000000 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dwarven/DwarvenHud.java +++ /dev/null @@ -1,144 +0,0 @@ -package me.xmrvizzy.skyblocker.skyblock.dwarven; - -import it.unimi.dsi.fastutil.ints.IntIntPair; -import me.xmrvizzy.skyblocker.config.SkyblockerConfigManager; -import me.xmrvizzy.skyblocker.skyblock.tabhud.widget.hud.HudCommsWidget; -import me.xmrvizzy.skyblocker.utils.scheduler.Scheduler; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; -import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.text.Text; -import net.minecraft.util.Formatting; - -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public class DwarvenHud { - - public static final MinecraftClient client = MinecraftClient.getInstance(); - public static List<Commission> commissionList = new ArrayList<>(); - - public static final List<Pattern> COMMISSIONS = Stream.of( - "(?:Titanium|Mithril|Hard Stone) Miner", - "(?:Ice Walker|Goblin|Goblin Raid|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) Puncher", - "(?<!Lucky )Raffle", - "Lucky Raffle", - "2x Mithril Powder Collector", - "(?: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)")) - .collect(Collectors.toList()); - - public static void init() { - ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> dispatcher.register(ClientCommandManager.literal("skyblocker") - .then(ClientCommandManager.literal("hud") - .then(ClientCommandManager.literal("dwarven") - .executes(Scheduler.queueOpenScreenCommand(DwarvenHudConfigScreen::new)))))); - - HudRenderCallback.EVENT.register((context, tickDelta) -> { - if (!SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.enabled - || client.options.playerListKey.isPressed() - || client.player == null - || commissionList.isEmpty()) { - return; - } - render(HudCommsWidget.INSTANCE, context, SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.x, - SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.y, commissionList); - }); - } - - public static IntIntPair getDimForConfig(List<Commission> commissions) { - return switch (SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.style) { - case SIMPLE -> { - HudCommsWidget.INSTANCE_CFG.updateData(commissions, false); - yield IntIntPair.of( - HudCommsWidget.INSTANCE_CFG.getWidth(), - HudCommsWidget.INSTANCE_CFG.getHeight()); - } - case FANCY -> { - HudCommsWidget.INSTANCE_CFG.updateData(commissions, true); - yield IntIntPair.of( - HudCommsWidget.INSTANCE_CFG.getWidth(), - HudCommsWidget.INSTANCE_CFG.getHeight()); - } - default -> IntIntPair.of(200, 20 * commissions.size()); - }; - } - - public static void render(HudCommsWidget hcw, DrawContext context, int hudX, int hudY, List<Commission> commissions) { - - switch (SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.style) { - case SIMPLE -> renderSimple(hcw, context, hudX, hudY, commissions); - case FANCY -> renderFancy(hcw, context, hudX, hudY, commissions); - case CLASSIC -> renderClassic(context, hudX, hudY, commissions); - } - } - - public static void renderClassic(DrawContext context, int hudX, int hudY, List<Commission> commissions) { - if (SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.enableBackground) { - context.fill(hudX, hudY, hudX + 200, hudY + (20 * commissions.size()), 0x64000000); - } - - int y = 0; - for (Commission commission : commissions) { - context - .drawTextWithShadow(client.textRenderer, - Text.literal(commission.commission + ": ") - .styled(style -> style.withColor(Formatting.AQUA)) - .append(Text.literal(commission.progression) - .styled(style -> style.withColor(Formatting.GREEN))), - hudX + 5, hudY + y + 5, 0xFFFFFFFF); - y += 20; - } - } - - public static void renderSimple(HudCommsWidget hcw, DrawContext context, int hudX, int hudY, List<Commission> commissions) { - hcw.updateData(commissions, false); - hcw.update(); - hcw.setX(hudX); - hcw.setY(hudY); - hcw.render(context, - SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.enableBackground); - } - - public static void renderFancy(HudCommsWidget hcw, DrawContext context, int hudX, int hudY, List<Commission> commissions) { - hcw.updateData(commissions, true); - hcw.update(); - hcw.setX(hudX); - hcw.setY(hudY); - hcw.render(context, - SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.enableBackground); - } - - public static void update() { - commissionList = new ArrayList<>(); - if (client.player == null || client.getNetworkHandler() == null || !SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.enabled) - return; - - client.getNetworkHandler().getPlayerList().forEach(playerListEntry -> { - if (playerListEntry.getDisplayName() != null) { - for (Pattern pattern : COMMISSIONS) { - Matcher matcher = pattern.matcher(playerListEntry.getDisplayName().getString()); - if (matcher.find()) { - commissionList.add(new Commission(matcher.group(1), matcher.group(2))); - } - - } - } - }); - } - - // steamroller tactics to get visibility from outside classes (HudCommsWidget) - public record Commission(String commission, String progression) { - } -}
\ No newline at end of file diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dwarven/DwarvenHudConfigScreen.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dwarven/DwarvenHudConfigScreen.java deleted file mode 100644 index 232817bb..00000000 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dwarven/DwarvenHudConfigScreen.java +++ /dev/null @@ -1,67 +0,0 @@ -package me.xmrvizzy.skyblocker.skyblock.dwarven; - -import it.unimi.dsi.fastutil.ints.IntIntPair; -import me.xmrvizzy.skyblocker.config.SkyblockerConfigManager; -import me.xmrvizzy.skyblocker.skyblock.dwarven.DwarvenHud.Commission; -import me.xmrvizzy.skyblocker.skyblock.tabhud.widget.hud.HudCommsWidget; -import me.xmrvizzy.skyblocker.utils.render.RenderHelper; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.text.Text; - -import java.awt.*; -import java.util.List; - -public class DwarvenHudConfigScreen extends Screen { - - private static final List<Commission> CFG_COMMS = List.of(new DwarvenHud.Commission("Test Commission 1", "1%"), new DwarvenHud.Commission("Test Commission 2", "2%")); - - private int hudX = SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.x; - private int hudY = SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.y; - private final Screen parent; - - protected DwarvenHudConfigScreen() { - this(null); - } - - public DwarvenHudConfigScreen(Screen parent) { - super(Text.of("Dwarven HUD Config")); - this.parent = parent; - } - - @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) { - super.render(context, mouseX, mouseY, delta); - renderBackground(context, mouseX, mouseY, delta); - DwarvenHud.render(HudCommsWidget.INSTANCE_CFG, context, hudX, hudY, List.of(new DwarvenHud.Commission("Test Commission 1", "1%"), new DwarvenHud.Commission("Test Commission 2", "2%"))); - context.drawCenteredTextWithShadow(textRenderer, "Right Click To Reset Position", width / 2, height / 2, Color.GRAY.getRGB()); - } - - @Override - public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) { - IntIntPair dims = DwarvenHud.getDimForConfig(CFG_COMMS); - if (RenderHelper.pointIsInArea(mouseX, mouseY, hudX, hudY, hudX + 200, hudY + 40) && button == 0) { - hudX = (int) Math.max(Math.min(mouseX - (double) dims.leftInt() / 2, this.width - dims.leftInt()), 0); - hudY = (int) Math.max(Math.min(mouseY - (double) dims.rightInt() / 2, this.height - dims.rightInt()), 0); - } - return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY); - } - - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - if (button == 1) { - IntIntPair dims = DwarvenHud.getDimForConfig(CFG_COMMS); - hudX = this.width / 2 - dims.leftInt(); - hudY = this.height / 2 - dims.rightInt(); - } - return super.mouseClicked(mouseX, mouseY, button); - } - - @Override - public void close() { - SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.x = hudX; - SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.y = hudY; - SkyblockerConfigManager.save(); - client.setScreen(parent); - } -} diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dwarven/Fetchur.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dwarven/Fetchur.java deleted file mode 100644 index d5c18545..00000000 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dwarven/Fetchur.java +++ /dev/null @@ -1,53 +0,0 @@ -package me.xmrvizzy.skyblocker.skyblock.dwarven; - -import me.xmrvizzy.skyblocker.config.SkyblockerConfigManager; -import me.xmrvizzy.skyblocker.utils.chat.ChatFilterResult; -import me.xmrvizzy.skyblocker.utils.chat.ChatPatternListener; -import net.minecraft.client.MinecraftClient; -import net.minecraft.text.Text; - -import java.util.HashMap; -import java.util.Map; -import java.util.regex.Matcher; - -public class Fetchur extends ChatPatternListener { - private static final Map<String, String> answers; - - public Fetchur() { - super("^§e\\[NPC] Fetchur§f: (?:its|theyre) ([a-zA-Z, \\-]*)$"); - } - - @Override - public ChatFilterResult state() { - return SkyblockerConfigManager.get().locations.dwarvenMines.solveFetchur ? ChatFilterResult.FILTER : ChatFilterResult.PASS; - } - - @Override - public boolean onMatch(Text message, Matcher matcher) { - MinecraftClient client = MinecraftClient.getInstance(); - if (client.player == null) return false; - String riddle = matcher.group(1); - String answer = answers.getOrDefault(riddle, riddle); - client.player.sendMessage(Text.of("§e[NPC] Fetchur§f: " + answer), false); - return true; - } - - static { - answers = new HashMap<>(); - answers.put("red and soft", Text.translatable("block.minecraft.red_wool").getString()); - answers.put("yellow and see through", Text.translatable("block.minecraft.yellow_stained_glass").getString()); - answers.put("circular and sometimes moves", Text.translatable("item.minecraft.compass").getString()); - // TODO remove when typo fixed by hypixel - answers.put("circlular and sometimes moves", Text.translatable("item.minecraft.compass").getString()); - answers.put("expensive minerals", "Mithril"); - answers.put("useful during celebrations", Text.translatable("item.minecraft.firework_rocket").getString()); - answers.put("hot and gives energy", "Cheap / Decent Coffee"); - answers.put("tall and can be opened", Text.translatable("block.minecraft.oak_door").getString()); - answers.put("brown and fluffy", Text.translatable("item.minecraft.rabbit_foot").getString()); - answers.put("explosive but more than usual", "Superboom TNT"); - answers.put("wearable and grows", Text.translatable("block.minecraft.pumpkin").getString()); - answers.put("shiny and makes sparks", Text.translatable("item.minecraft.flint_and_steel").getString()); - answers.put("red and white and you can mine it", Text.translatable("block.minecraft.nether_quartz_ore").getString()); - answers.put("round and green, or purple", Text.translatable("item.minecraft.ender_pearl").getString()); - } -} diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dwarven/Puzzler.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dwarven/Puzzler.java deleted file mode 100644 index 90a0e30f..00000000 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dwarven/Puzzler.java +++ /dev/null @@ -1,39 +0,0 @@ -package me.xmrvizzy.skyblocker.skyblock.dwarven; - -import me.xmrvizzy.skyblocker.config.SkyblockerConfigManager; -import me.xmrvizzy.skyblocker.utils.chat.ChatFilterResult; -import me.xmrvizzy.skyblocker.utils.chat.ChatPatternListener; -import net.minecraft.block.Blocks; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.text.Text; -import net.minecraft.util.math.BlockPos; - -import java.util.regex.Matcher; - -public class Puzzler extends ChatPatternListener { - public Puzzler() { - super("^§e\\[NPC] §dPuzzler§f: ((?:§d▲|§5▶|§b◀|§a▼){10})$"); - } - - @Override - public ChatFilterResult state() { - return SkyblockerConfigManager.get().locations.dwarvenMines.solvePuzzler ? null : ChatFilterResult.PASS; - } - - @Override - public boolean onMatch(Text message, Matcher matcher) { - int x = 181; - int z = 135; - for (char c : matcher.group(1).toCharArray()) { - if (c == '▲') z++; - else if (c == '▼') z--; - else if (c == '◀') x++; - else if (c == '▶') x--; - } - ClientWorld world = MinecraftClient.getInstance().world; - if (world != null) - world.setBlockState(new BlockPos(x, 195, z), Blocks.CRIMSON_PLANKS.getDefaultState()); - return false; - } -}
\ No newline at end of file |