From 049f988c904e7bee85e4d0a03e2dbbcf0047d27e Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Mon, 22 May 2023 20:30:12 -0400 Subject: Add Livid Color --- .../skyblocker/skyblock/dungeon/LividColor.java | 43 ++++++++++++++++++++++ .../skyblocker/skyblock/dungeon/Reparty.java | 11 +++--- 2 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/LividColor.java (limited to 'src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon') diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/LividColor.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/LividColor.java new file mode 100644 index 00000000..d05c8cb9 --- /dev/null +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/LividColor.java @@ -0,0 +1,43 @@ +package me.xmrvizzy.skyblocker.skyblock.dungeon; + +import me.xmrvizzy.skyblocker.SkyblockerMod; +import me.xmrvizzy.skyblocker.config.SkyblockerConfig; +import me.xmrvizzy.skyblocker.utils.Utils; +import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents; +import net.minecraft.client.MinecraftClient; +import net.minecraft.util.math.BlockPos; + +public class LividColor { + private static int tenTicks = 0; + + public static void init() { + ClientReceiveMessageEvents.ALLOW_GAME.register((message, overlay) -> { + if (SkyblockerConfig.get().locations.dungeons.lividColor && message.getString().equals("[BOSS] Livid: I respect you for making it to here, but I'll be your undoing.")) { + tenTicks = 8; + } + return true; + }); + } + + public static void update() { + MinecraftClient client = MinecraftClient.getInstance(); + if (tenTicks != 0) { + if (SkyblockerConfig.get().locations.dungeons.lividColor && Utils.isInDungeons() && client.world != null) { + if (tenTicks == 1) { + SkyblockerMod.getInstance().messageScheduler.sendMessageAfterCooldown(SkyblockerConfig.get().locations.dungeons.lividColorText.replace("[color]", "red")); + tenTicks = 0; + return; + } + String key = client.world.getBlockState(new BlockPos(5, 110, 42)).getBlock().getTranslationKey(); + if (key.startsWith("block.minecraft.") && key.endsWith("wool") && !key.endsWith("red_wool")) { + SkyblockerMod.getInstance().messageScheduler.sendMessageAfterCooldown(SkyblockerConfig.get().locations.dungeons.lividColorText.replace("[color]", key.substring(16, key.length() - 5))); + tenTicks = 0; + return; + } + tenTicks--; + } else { + tenTicks = 0; + } + } + } +} diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Reparty.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Reparty.java index fdc39c42..d6e799ab 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Reparty.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Reparty.java @@ -29,7 +29,7 @@ public class Reparty extends ChatPatternListener { ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> dispatcher.register(ClientCommandManager.literal("rp").executes(context -> { if (!Utils.isOnSkyblock() || this.repartying || client.player == null) return 0; this.repartying = true; - client.player.networkHandler.sendCommand("p list"); + SkyblockerMod.getInstance().messageScheduler.sendMessageAfterCooldown("/p list"); return 0; }))); } @@ -63,16 +63,15 @@ public class Reparty extends ChatPatternListener { this.repartying = false; return; } - sendCommand(playerEntity, "p disband", 1); + sendCommand("p disband", 1); for (int i = 0; i < this.players.length; ++i) { String command = "p invite " + this.players[i]; - sendCommand(playerEntity, command, i + 2); + sendCommand(command, i + 2); } skyblocker.scheduler.schedule(() -> this.repartying = false, this.players.length + 2); } - private void sendCommand(ClientPlayerEntity player, String command, int delay) { - // skyblocker.scheduler.schedule(() -> player.sendChatMessage(command, Text.of(command)), delay * BASE_DELAY); - skyblocker.scheduler.schedule(() -> player.networkHandler.sendCommand(command), delay * BASE_DELAY); + private void sendCommand(String command, int delay) { + skyblocker.messageScheduler.queueMessage(command, delay * BASE_DELAY); } } -- cgit From 98e875d281b99de6df4e150656e501a3121d2d81 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sun, 28 May 2023 19:38:12 -0400 Subject: Fix Reparty commands and update config --- .../java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java | 11 +++++++++-- .../me/xmrvizzy/skyblocker/skyblock/dungeon/LividColor.java | 8 ++++---- .../java/me/xmrvizzy/skyblocker/skyblock/dungeon/Reparty.java | 4 ++-- src/main/resources/assets/skyblocker/lang/en_us.json | 5 ++++- 4 files changed, 19 insertions(+), 9 deletions(-) (limited to 'src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon') diff --git a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java index 65e5c392..c87f0ad9 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java @@ -269,12 +269,19 @@ public class SkyblockerConfig implements ConfigData { public boolean solveThreeWeirdos = true; public boolean blazesolver = true; public boolean solveTrivia = true; - public boolean lividColor = true; - public String lividColorText = "[color]"; + @ConfigEntry.Gui.CollapsibleObject + public LividColor lividColor = new LividColor(); @ConfigEntry.Gui.CollapsibleObject() public Terminals terminals = new Terminals(); } + public static class LividColor { + @ConfigEntry.Gui.Tooltip() + public boolean enableLividColor = true; + @ConfigEntry.Gui.Tooltip() + public String lividColorText = "The livid color is [color]"; + } + public static class Terminals { public boolean solveColor = true; public boolean solveOrder = true; diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/LividColor.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/LividColor.java index d05c8cb9..276a41b6 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/LividColor.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/LividColor.java @@ -12,7 +12,7 @@ public class LividColor { public static void init() { ClientReceiveMessageEvents.ALLOW_GAME.register((message, overlay) -> { - if (SkyblockerConfig.get().locations.dungeons.lividColor && message.getString().equals("[BOSS] Livid: I respect you for making it to here, but I'll be your undoing.")) { + if (SkyblockerConfig.get().locations.dungeons.lividColor.enableLividColor && message.getString().equals("[BOSS] Livid: I respect you for making it to here, but I'll be your undoing.")) { tenTicks = 8; } return true; @@ -22,15 +22,15 @@ public class LividColor { public static void update() { MinecraftClient client = MinecraftClient.getInstance(); if (tenTicks != 0) { - if (SkyblockerConfig.get().locations.dungeons.lividColor && Utils.isInDungeons() && client.world != null) { + if (SkyblockerConfig.get().locations.dungeons.lividColor.enableLividColor && Utils.isInDungeons() && client.world != null) { if (tenTicks == 1) { - SkyblockerMod.getInstance().messageScheduler.sendMessageAfterCooldown(SkyblockerConfig.get().locations.dungeons.lividColorText.replace("[color]", "red")); + SkyblockerMod.getInstance().messageScheduler.sendMessageAfterCooldown(SkyblockerConfig.get().locations.dungeons.lividColor.lividColorText.replace("[color]", "red")); tenTicks = 0; return; } String key = client.world.getBlockState(new BlockPos(5, 110, 42)).getBlock().getTranslationKey(); if (key.startsWith("block.minecraft.") && key.endsWith("wool") && !key.endsWith("red_wool")) { - SkyblockerMod.getInstance().messageScheduler.sendMessageAfterCooldown(SkyblockerConfig.get().locations.dungeons.lividColorText.replace("[color]", key.substring(16, key.length() - 5))); + SkyblockerMod.getInstance().messageScheduler.sendMessageAfterCooldown(SkyblockerConfig.get().locations.dungeons.lividColor.lividColorText.replace("[color]", key.substring(16, key.length() - 5))); tenTicks = 0; return; } diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Reparty.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Reparty.java index d6e799ab..29c37b94 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Reparty.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Reparty.java @@ -63,9 +63,9 @@ public class Reparty extends ChatPatternListener { this.repartying = false; return; } - sendCommand("p disband", 1); + sendCommand("/p disband", 1); for (int i = 0; i < this.players.length; ++i) { - String command = "p invite " + this.players[i]; + String command = "/p invite " + this.players[i]; sendCommand(command, i + 2); } skyblocker.scheduler.schedule(() -> this.repartying = false, this.players.length + 2); diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 65cb1956..922f73a9 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -161,7 +161,10 @@ "text.autoconfig.skyblocker.option.locations.dungeons.blazesolver": "Solve Blaze Puzzle", "text.autoconfig.skyblocker.option.locations.dungeons.solveTrivia": "Solve Trivia Puzzle", "text.autoconfig.skyblocker.option.locations.dungeons.lividColor": "Livid Color", - "text.autoconfig.skyblocker.option.locations.dungeons.lividColorText": "Livid Color Text", + "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColor": "Enable Livid Color", + "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColor.@Tooltip": "Send the livid color in the chat during the Livid boss fight.", + "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.lividColorText": "Livid Color Text", + "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.lividColorText.@Tooltip": "Text which will be sent in the chat during the Livid boss fight. The string \"[color]\" will be replaced with the livid color.", "text.autoconfig.skyblocker.option.locations.dungeons.terminals": "Terminal Solvers", "text.autoconfig.skyblocker.option.locations.dungeons.terminals.solveColor": "Solve Select Colored", "text.autoconfig.skyblocker.option.locations.dungeons.terminals.solveOrder": "Solve Click In Order", -- cgit