From de47c578ae91187d143dae07b06b1cac0496ea82 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Mon, 30 Oct 2023 00:25:07 -0400 Subject: [PATCH 1/6] Refactor LividColor --- .../skyblocker/skyblock/dungeon/LividColor.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java index 762a6e1728..588140bec1 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java @@ -5,6 +5,7 @@ import de.hysky.skyblocker.utils.scheduler.MessageScheduler; import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents; import net.minecraft.client.MinecraftClient; +import net.minecraft.registry.Registries; import net.minecraft.util.math.BlockPos; public class LividColor { @@ -23,14 +24,12 @@ public static void update() { if (tenTicks != 0) { if (SkyblockerConfigManager.get().locations.dungeons.lividColor.enableLividColor && Utils.isInDungeons() && client.world != null) { if (tenTicks == 1) { - MessageScheduler.INSTANCE.sendMessageAfterCooldown(SkyblockerConfigManager.get().locations.dungeons.lividColor.lividColorText.replace("[color]", "red")); - tenTicks = 0; + onLividColorFound("red"); 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")) { - MessageScheduler.INSTANCE.sendMessageAfterCooldown(SkyblockerConfigManager.get().locations.dungeons.lividColor.lividColorText.replace("[color]", key.substring(16, key.length() - 5))); - tenTicks = 0; + String key = Registries.BLOCK.getId(client.world.getBlockState(new BlockPos(5, 110, 42)).getBlock()).getPath(); + if (key.endsWith("wool") && !key.equals("red_wool")) { + onLividColorFound(key.substring(0, key.length() - 5)); return; } tenTicks--; @@ -39,4 +38,9 @@ public static void update() { } } } + + private static void onLividColorFound(String color) { + MessageScheduler.INSTANCE.sendMessageAfterCooldown(SkyblockerConfigManager.get().locations.dungeons.lividColor.lividColorText.replace("[color]", color)); + tenTicks = 0; + } } From ce11f3c78910f27534d2d2aba76d17857757edde Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sat, 4 Nov 2023 00:22:08 -0400 Subject: [PATCH 2/6] Add Livid Highlight --- .../skyblock/dungeon/LividColor.java | 40 ++++++++++++++++--- .../skyblock/dungeon/StarredMobGlow.java | 15 ++++++- 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java index 588140bec1..a8428ff6cd 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java @@ -4,12 +4,33 @@ import de.hysky.skyblocker.utils.Utils; import de.hysky.skyblocker.utils.scheduler.MessageScheduler; import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents; +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; import net.minecraft.client.MinecraftClient; +import net.minecraft.entity.Entity; import net.minecraft.registry.Registries; +import net.minecraft.text.Text; +import net.minecraft.text.TextColor; +import net.minecraft.util.Formatting; import net.minecraft.util.math.BlockPos; +import java.util.List; +import java.util.Map; + public class LividColor { + private static final Map WOOL_TO_FORMATTING = Map.of( + Blocks.WHITE_WOOL, Formatting.WHITE, + Blocks.MAGENTA_WOOL, Formatting.LIGHT_PURPLE, + Blocks.RED_WOOL, Formatting.RED, + Blocks.GRAY_WOOL, Formatting.GRAY, + Blocks.GREEN_WOOL, Formatting.DARK_GREEN, + Blocks.LIME_WOOL, Formatting.GREEN, + Blocks.BLUE_WOOL, Formatting.BLUE, + Blocks.PURPLE_WOOL, Formatting.DARK_PURPLE, + Blocks.YELLOW_WOOL, Formatting.YELLOW + ); private static int tenTicks = 0; + private static Formatting color; public static void init() { ClientReceiveMessageEvents.GAME.register((message, overlay) -> { @@ -24,12 +45,12 @@ public static void update() { if (tenTicks != 0) { if (SkyblockerConfigManager.get().locations.dungeons.lividColor.enableLividColor && Utils.isInDungeons() && client.world != null) { if (tenTicks == 1) { - onLividColorFound("red"); + onLividColorFound(Blocks.RED_WOOL); return; } - String key = Registries.BLOCK.getId(client.world.getBlockState(new BlockPos(5, 110, 42)).getBlock()).getPath(); - if (key.endsWith("wool") && !key.equals("red_wool")) { - onLividColorFound(key.substring(0, key.length() - 5)); + Block color = client.world.getBlockState(new BlockPos(5, 110, 42)).getBlock(); + if (WOOL_TO_FORMATTING.containsKey(color) && !color.equals(Blocks.RED_WOOL)) { + onLividColorFound(color); return; } tenTicks--; @@ -39,8 +60,15 @@ public static void update() { } } - private static void onLividColorFound(String color) { - MessageScheduler.INSTANCE.sendMessageAfterCooldown(SkyblockerConfigManager.get().locations.dungeons.lividColor.lividColorText.replace("[color]", color)); + private static void onLividColorFound(Block color) { + LividColor.color = WOOL_TO_FORMATTING.get(color); + String colorString = Registries.BLOCK.getId(color).getPath(); + MessageScheduler.INSTANCE.sendMessageAfterCooldown(SkyblockerConfigManager.get().locations.dungeons.lividColor.lividColorText.replace("[color]", colorString.substring(0, colorString.length() - 5))); tenTicks = 0; } + + public static boolean shouldGlow(Entity armorStand) { + List nameTexts = armorStand.getName().getSiblings(); + return !nameTexts.isEmpty() && nameTexts.get(0).getStyle().getColor() == TextColor.fromFormatting(color); + } } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/StarredMobGlow.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/StarredMobGlow.java index 2072017d41..db478b7ca6 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/StarredMobGlow.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/StarredMobGlow.java @@ -8,6 +8,7 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.predicate.entity.EntityPredicates; import net.minecraft.util.math.Box; +import net.minecraft.world.World; import java.util.List; @@ -23,13 +24,19 @@ public static boolean shouldMobGlow(Entity entity) { case "Lost Adventurer", "Shadow Assassin", "Diamond Guy" -> { return true; } + default -> { + List armorStands = getArmorStands(entity.getWorld(), box); + + if (!armorStands.isEmpty() && LividColor.shouldGlow(armorStands.get(0))) { + return true; + } + } } } // Regular Mobs if (!(entity instanceof ArmorStandEntity)) { - Box searchBox = box.expand(0, 2, 0); - List armorStands = entity.getWorld().getEntitiesByClass(ArmorStandEntity.class, searchBox, EntityPredicates.NOT_MOUNTED); + List armorStands = getArmorStands(entity.getWorld(), box); if (!armorStands.isEmpty() && armorStands.get(0).getName().getString().contains("✯")) return true; } @@ -41,6 +48,10 @@ public static boolean shouldMobGlow(Entity entity) { return false; } + private static List getArmorStands(World world, Box box) { + return world.getEntitiesByClass(ArmorStandEntity.class, box.expand(0, 2, 0), EntityPredicates.NOT_MOUNTED); + } + public static int getGlowColor(Entity entity) { if (entity instanceof PlayerEntity) { return switch (entity.getName().getString()) { From b1104c555ac49e1f24bb749f73a5c4039e714521 Mon Sep 17 00:00:00 2001 From: Aaron <51387595+AzureAaron@users.noreply.github.com> Date: Sat, 4 Nov 2023 01:16:25 -0400 Subject: [PATCH 3/6] Fancify Livid Glow --- .../skyblocker/skyblock/dungeon/LividColor.java | 16 ++++++++++++++++ .../skyblock/dungeon/StarredMobGlow.java | 9 +++++++-- .../resources/assets/skyblocker/lang/en_us.json | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java index a8428ff6cd..10959ef3ba 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java @@ -71,4 +71,20 @@ public static boolean shouldGlow(Entity armorStand) { List nameTexts = armorStand.getName().getSiblings(); return !nameTexts.isEmpty() && nameTexts.get(0).getStyle().getColor() == TextColor.fromFormatting(color); } + + public static int getGlowColor(String name) { + return switch (name) { + case "Arcade Livid" -> Formatting.YELLOW.getColorValue(); + case "Crossed Livid" -> Formatting.LIGHT_PURPLE.getColorValue(); + case "Doctor Livid" -> Formatting.GRAY.getColorValue(); + case "Frog Livid" -> Formatting.DARK_GREEN.getColorValue(); + case "Hockey Livid" -> Formatting.RED.getColorValue(); + case "Purple Livid" -> Formatting.DARK_PURPLE.getColorValue(); + case "Scream Livid" -> Formatting.BLUE.getColorValue(); + case "Smile Livid" -> Formatting.GREEN.getColorValue(); + case "Vendetta Livid" -> Formatting.WHITE.getColorValue(); + + default -> Formatting.WHITE.getColorValue(); + }; + } } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/StarredMobGlow.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/StarredMobGlow.java index db478b7ca6..4d159988a2 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/StarredMobGlow.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/StarredMobGlow.java @@ -24,7 +24,8 @@ public static boolean shouldMobGlow(Entity entity) { case "Lost Adventurer", "Shadow Assassin", "Diamond Guy" -> { return true; } - default -> { + case "Arcade Livid", "Crossed Livid", "Doctor Livid", "Frog Livid", "Hockey Livid", + "Purple Livid", "Scream Livid", "Smile Livid", "Vendetta Livid" -> { List armorStands = getArmorStands(entity.getWorld(), box); if (!armorStands.isEmpty() && LividColor.shouldGlow(armorStands.get(0))) { @@ -53,11 +54,15 @@ private static List getArmorStands(World world, Box box) { } public static int getGlowColor(Entity entity) { + String name = entity.getName().getString(); + if (entity instanceof PlayerEntity) { - return switch (entity.getName().getString()) { + return switch (name) { case "Lost Adventurer" -> 0xfee15c; case "Shadow Assassin" -> 0x5b2cb2; case "Diamond Guy" -> 0x57c2f7; + case "Arcade Livid", "Crossed Livid", "Doctor Livid", "Frog Livid", "Hockey Livid", + "Purple Livid", "Scream Livid", "Smile Livid", "Vendetta Livid" -> LividColor.getGlowColor(name); default -> 0xf57738; }; } diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index c0f3c7bace..f4154b54d7 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -189,7 +189,7 @@ "text.autoconfig.skyblocker.option.locations.dungeons.mapScreen": "Dungeon Map Placement Config...", "text.autoconfig.skyblocker.option.locations.dungeons.mapScaling": "Map Scaling", "text.autoconfig.skyblocker.option.locations.dungeons.starredMobGlow": "Starred Mob Glow", - "text.autoconfig.skyblocker.option.locations.dungeons.starredMobGlow.@Tooltip": "Applies the glowing effect to starred mobs that are visible.", + "text.autoconfig.skyblocker.option.locations.dungeons.starredMobGlow.@Tooltip": "Applies the glowing effect to starred mobs that are visible. Also applies it to the correct Livid in F5/M5.", "text.autoconfig.skyblocker.option.locations.dungeons.solveThreeWeirdos": "Solve Three Weirdos Puzzle", "text.autoconfig.skyblocker.option.locations.dungeons.blazeSolver": "Solve Blaze Puzzle", "text.autoconfig.skyblocker.option.locations.dungeons.blazeSolver.@Tooltip": "Boxes the correct blaze in green, also draws a line to and boxes the next blaze to kill in white.", From b6dadda58414f67a00599c5d3f96e91af925165c Mon Sep 17 00:00:00 2001 From: Aaron <51387595+AzureAaron@users.noreply.github.com> Date: Sat, 4 Nov 2023 01:53:09 -0400 Subject: [PATCH 4/6] Refactor switches --- .../skyblock/dungeon/LividColor.java | 21 ++++++++++++------- .../skyblock/dungeon/StarredMobGlow.java | 16 +++++--------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java index 10959ef3ba..0c774fac1a 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java @@ -7,14 +7,10 @@ import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.client.MinecraftClient; -import net.minecraft.entity.Entity; import net.minecraft.registry.Registries; -import net.minecraft.text.Text; -import net.minecraft.text.TextColor; import net.minecraft.util.Formatting; import net.minecraft.util.math.BlockPos; -import java.util.List; import java.util.Map; public class LividColor { @@ -67,9 +63,20 @@ private static void onLividColorFound(Block color) { tenTicks = 0; } - public static boolean shouldGlow(Entity armorStand) { - List nameTexts = armorStand.getName().getSiblings(); - return !nameTexts.isEmpty() && nameTexts.get(0).getStyle().getColor() == TextColor.fromFormatting(color); + public static boolean shouldGlow(String name) { + return switch (name) { + case "Arcade Livid" -> color == Formatting.YELLOW; + case "Crossed Livid" -> color == Formatting.LIGHT_PURPLE; + case "Doctor Livid" -> color == Formatting.GRAY; + case "Frog Livid" -> color == Formatting.DARK_GREEN; + case "Hockey Livid" -> color == Formatting.RED; + case "Purple Livid" -> color == Formatting.DARK_PURPLE; + case "Scream Livid" -> color == Formatting.BLUE; + case "Smile Livid" -> color == Formatting.GREEN; + case "Vendetta Livid" -> color == Formatting.WHITE; + + default -> false; + }; } public static int getGlowColor(String name) { diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/StarredMobGlow.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/StarredMobGlow.java index 4d159988a2..4529797c7f 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/StarredMobGlow.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/StarredMobGlow.java @@ -18,20 +18,14 @@ public static boolean shouldMobGlow(Entity entity) { Box box = entity.getBoundingBox(); if (Utils.isInDungeons() && !entity.isInvisible() && OcclusionCulling.isVisible(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ)) { + String name = entity.getName().getString(); + // Minibosses if (entity instanceof PlayerEntity) { - switch (entity.getName().getString()) { - case "Lost Adventurer", "Shadow Assassin", "Diamond Guy" -> { - return true; - } + switch (name) { + case "Lost Adventurer", "Shadow Assassin", "Diamond Guy": return true; case "Arcade Livid", "Crossed Livid", "Doctor Livid", "Frog Livid", "Hockey Livid", - "Purple Livid", "Scream Livid", "Smile Livid", "Vendetta Livid" -> { - List armorStands = getArmorStands(entity.getWorld(), box); - - if (!armorStands.isEmpty() && LividColor.shouldGlow(armorStands.get(0))) { - return true; - } - } + "Purple Livid", "Scream Livid", "Smile Livid", "Vendetta Livid": return LividColor.shouldGlow(name); } } From 4acac061ce6274ecbf57564ac3b8f9fdc4582e4f Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sat, 4 Nov 2023 11:02:00 -0400 Subject: [PATCH 5/6] Refactor MobGlow --- .../skyblocker/config/SkyblockerConfig.java | 5 +- .../config/categories/DungeonsCategory.java | 18 ++++-- .../skyblocker/mixin/WorldRendererMixin.java | 18 +++--- .../skyblock/dungeon/LividColor.java | 63 +++++++++---------- .../{StarredMobGlow.java => MobGlow.java} | 10 +-- .../assets/skyblocker/lang/en_ca.json | 4 +- .../assets/skyblocker/lang/en_us.json | 6 +- .../assets/skyblocker/lang/fr_fr.json | 4 +- .../assets/skyblocker/lang/pt_br.json | 4 +- .../assets/skyblocker/lang/ru_ru.json | 4 +- .../assets/skyblocker/lang/zh_cn.json | 4 +- 11 files changed, 71 insertions(+), 69 deletions(-) rename src/main/java/de/hysky/skyblocker/skyblock/dungeon/{StarredMobGlow.java => MobGlow.java} (85%) diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index 150179950d..84b9e9caf3 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -656,7 +656,10 @@ public static class DungeonChestProfit { public static class LividColor { @SerialEntry - public boolean enableLividColor = true; + public boolean enableLividColorGlow = true; + + @SerialEntry + public boolean enableLividColorText = true; @SerialEntry public String lividColorText = "The livid color is [color]"; diff --git a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java index fdb1389259..cb390a7151 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java @@ -293,11 +293,19 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.lividColor")) .collapsed(true) .option(Option.createBuilder() - .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColor")) - .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColor.@Tooltip"))) - .binding(defaults.locations.dungeons.lividColor.enableLividColor, - () -> config.locations.dungeons.lividColor.enableLividColor, - newValue -> config.locations.dungeons.lividColor.enableLividColor = newValue) + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColorGlow")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColorGlow.@Tooltip"))) + .binding(defaults.locations.dungeons.lividColor.enableLividColorGlow, + () -> config.locations.dungeons.lividColor.enableLividColorGlow, + newValue -> config.locations.dungeons.lividColor.enableLividColorGlow = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColorText")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColorText.@Tooltip"))) + .binding(defaults.locations.dungeons.lividColor.enableLividColorText, + () -> config.locations.dungeons.lividColor.enableLividColorText, + newValue -> config.locations.dungeons.lividColor.enableLividColorText = newValue) .controller(ConfigUtils::createBooleanController) .build()) .option(Option.createBuilder() diff --git a/src/main/java/de/hysky/skyblocker/mixin/WorldRendererMixin.java b/src/main/java/de/hysky/skyblocker/mixin/WorldRendererMixin.java index e723c99845..78c61416e0 100644 --- a/src/main/java/de/hysky/skyblocker/mixin/WorldRendererMixin.java +++ b/src/main/java/de/hysky/skyblocker/mixin/WorldRendererMixin.java @@ -9,25 +9,21 @@ import com.llamalad7.mixinextras.sugar.Share; import com.llamalad7.mixinextras.sugar.ref.LocalBooleanRef; -import de.hysky.skyblocker.config.SkyblockerConfigManager; -import de.hysky.skyblocker.skyblock.dungeon.StarredMobGlow; +import de.hysky.skyblocker.skyblock.dungeon.MobGlow; import net.minecraft.client.render.WorldRenderer; import net.minecraft.entity.Entity; @Mixin(WorldRenderer.class) public class WorldRendererMixin { - @ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;hasOutline(Lnet/minecraft/entity/Entity;)Z")) - private boolean skyblocker$shouldStarredMobGlow(boolean original, @Local Entity entity, @Share("isGlowingStarredMob") LocalBooleanRef isGlowingStarredMob) { - boolean isAStarredMobThatShouldGlow = SkyblockerConfigManager.get().locations.dungeons.starredMobGlow && StarredMobGlow.shouldMobGlow(entity); - - isGlowingStarredMob.set(isAStarredMobThatShouldGlow); - - return original || isAStarredMobThatShouldGlow; + private boolean skyblocker$shouldMobGlow(boolean original, @Local Entity entity, @Share("hasCustomGlow") LocalBooleanRef hasCustomGlow) { + boolean shouldGlow = MobGlow.shouldMobGlow(entity); + hasCustomGlow.set(shouldGlow); + return original || shouldGlow; } @ModifyVariable(method = "render", at = @At("STORE"), ordinal = 0) - private int skyblocker$modifyGlowColor(int color, @Local Entity entity, @Share("isGlowingStarredMob") LocalBooleanRef isGlowingStarredMob) { - return isGlowingStarredMob.get() ? StarredMobGlow.getGlowColor(entity) : color; + private int skyblocker$modifyGlowColor(int color, @Local Entity entity, @Share("hasCustomGlow") LocalBooleanRef hasCustomGlow) { + return hasCustomGlow.get() ? MobGlow.getGlowColor(entity) : color; } } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java index 0c774fac1a..f40b7859f8 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/LividColor.java @@ -1,5 +1,6 @@ package de.hysky.skyblocker.skyblock.dungeon; +import de.hysky.skyblocker.config.SkyblockerConfig; import de.hysky.skyblocker.config.SkyblockerConfigManager; import de.hysky.skyblocker.utils.Utils; import de.hysky.skyblocker.utils.scheduler.MessageScheduler; @@ -15,22 +16,34 @@ public class LividColor { private static final Map WOOL_TO_FORMATTING = Map.of( - Blocks.WHITE_WOOL, Formatting.WHITE, - Blocks.MAGENTA_WOOL, Formatting.LIGHT_PURPLE, Blocks.RED_WOOL, Formatting.RED, - Blocks.GRAY_WOOL, Formatting.GRAY, - Blocks.GREEN_WOOL, Formatting.DARK_GREEN, + Blocks.YELLOW_WOOL, Formatting.YELLOW, Blocks.LIME_WOOL, Formatting.GREEN, + Blocks.GREEN_WOOL, Formatting.DARK_GREEN, Blocks.BLUE_WOOL, Formatting.BLUE, + Blocks.MAGENTA_WOOL, Formatting.LIGHT_PURPLE, Blocks.PURPLE_WOOL, Formatting.DARK_PURPLE, - Blocks.YELLOW_WOOL, Formatting.YELLOW + Blocks.GRAY_WOOL, Formatting.GRAY, + Blocks.WHITE_WOOL, Formatting.WHITE + ); + private static final Map LIVID_TO_FORMATTING = Map.of( + "Hockey Livid", Formatting.RED, + "Arcade Livid", Formatting.YELLOW, + "Smile Livid", Formatting.GREEN, + "Frog Livid", Formatting.DARK_GREEN, + "Scream Livid", Formatting.BLUE, + "Crossed Livid", Formatting.LIGHT_PURPLE, + "Purple Livid", Formatting.DARK_PURPLE, + "Doctor Livid", Formatting.GRAY, + "Vendetta Livid", Formatting.WHITE ); private static int tenTicks = 0; private static Formatting color; public static void init() { ClientReceiveMessageEvents.GAME.register((message, overlay) -> { - if (SkyblockerConfigManager.get().locations.dungeons.lividColor.enableLividColor && message.getString().equals("[BOSS] Livid: I respect you for making it to here, but I'll be your undoing.")) { + SkyblockerConfig.LividColor config = SkyblockerConfigManager.get().locations.dungeons.lividColor; + if ((config.enableLividColorText || config.enableLividColorGlow) && message.getString().equals("[BOSS] Livid: I respect you for making it to here, but I'll be your undoing.")) { tenTicks = 8; } }); @@ -39,7 +52,8 @@ public static void init() { public static void update() { MinecraftClient client = MinecraftClient.getInstance(); if (tenTicks != 0) { - if (SkyblockerConfigManager.get().locations.dungeons.lividColor.enableLividColor && Utils.isInDungeons() && client.world != null) { + SkyblockerConfig.LividColor config = SkyblockerConfigManager.get().locations.dungeons.lividColor; + if ((config.enableLividColorText || config.enableLividColorGlow) && Utils.isInDungeons() && client.world != null) { if (tenTicks == 1) { onLividColorFound(Blocks.RED_WOOL); return; @@ -58,40 +72,19 @@ public static void update() { private static void onLividColorFound(Block color) { LividColor.color = WOOL_TO_FORMATTING.get(color); - String colorString = Registries.BLOCK.getId(color).getPath(); - MessageScheduler.INSTANCE.sendMessageAfterCooldown(SkyblockerConfigManager.get().locations.dungeons.lividColor.lividColorText.replace("[color]", colorString.substring(0, colorString.length() - 5))); + if (SkyblockerConfigManager.get().locations.dungeons.lividColor.enableLividColorText) { + String colorString = Registries.BLOCK.getId(color).getPath(); + MessageScheduler.INSTANCE.sendMessageAfterCooldown(SkyblockerConfigManager.get().locations.dungeons.lividColor.lividColorText.replaceAll("\\[color]", colorString.substring(0, colorString.length() - 5))); + } tenTicks = 0; } public static boolean shouldGlow(String name) { - return switch (name) { - case "Arcade Livid" -> color == Formatting.YELLOW; - case "Crossed Livid" -> color == Formatting.LIGHT_PURPLE; - case "Doctor Livid" -> color == Formatting.GRAY; - case "Frog Livid" -> color == Formatting.DARK_GREEN; - case "Hockey Livid" -> color == Formatting.RED; - case "Purple Livid" -> color == Formatting.DARK_PURPLE; - case "Scream Livid" -> color == Formatting.BLUE; - case "Smile Livid" -> color == Formatting.GREEN; - case "Vendetta Livid" -> color == Formatting.WHITE; - - default -> false; - }; + return SkyblockerConfigManager.get().locations.dungeons.lividColor.enableLividColorGlow && color == LIVID_TO_FORMATTING.get(name); } + @SuppressWarnings("DataFlowIssue") public static int getGlowColor(String name) { - return switch (name) { - case "Arcade Livid" -> Formatting.YELLOW.getColorValue(); - case "Crossed Livid" -> Formatting.LIGHT_PURPLE.getColorValue(); - case "Doctor Livid" -> Formatting.GRAY.getColorValue(); - case "Frog Livid" -> Formatting.DARK_GREEN.getColorValue(); - case "Hockey Livid" -> Formatting.RED.getColorValue(); - case "Purple Livid" -> Formatting.DARK_PURPLE.getColorValue(); - case "Scream Livid" -> Formatting.BLUE.getColorValue(); - case "Smile Livid" -> Formatting.GREEN.getColorValue(); - case "Vendetta Livid" -> Formatting.WHITE.getColorValue(); - - default -> Formatting.WHITE.getColorValue(); - }; + return LIVID_TO_FORMATTING.containsKey(name) ? LIVID_TO_FORMATTING.get(name).getColorValue() : Formatting.WHITE.getColorValue(); } } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/StarredMobGlow.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/MobGlow.java similarity index 85% rename from src/main/java/de/hysky/skyblocker/skyblock/dungeon/StarredMobGlow.java rename to src/main/java/de/hysky/skyblocker/skyblock/dungeon/MobGlow.java index 4529797c7f..523b7a98b7 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/StarredMobGlow.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/MobGlow.java @@ -1,5 +1,6 @@ package de.hysky.skyblocker.skyblock.dungeon; +import de.hysky.skyblocker.config.SkyblockerConfigManager; import de.hysky.skyblocker.utils.Utils; import de.hysky.skyblocker.utils.render.culling.OcclusionCulling; import net.minecraft.entity.Entity; @@ -12,8 +13,7 @@ import java.util.List; -public class StarredMobGlow { - +public class MobGlow { public static boolean shouldMobGlow(Entity entity) { Box box = entity.getBoundingBox(); @@ -23,7 +23,7 @@ public static boolean shouldMobGlow(Entity entity) { // Minibosses if (entity instanceof PlayerEntity) { switch (name) { - case "Lost Adventurer", "Shadow Assassin", "Diamond Guy": return true; + case "Lost Adventurer", "Shadow Assassin", "Diamond Guy": return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow; case "Arcade Livid", "Crossed Livid", "Doctor Livid", "Frog Livid", "Hockey Livid", "Purple Livid", "Scream Livid", "Smile Livid", "Vendetta Livid": return LividColor.shouldGlow(name); } @@ -33,11 +33,11 @@ public static boolean shouldMobGlow(Entity entity) { if (!(entity instanceof ArmorStandEntity)) { List armorStands = getArmorStands(entity.getWorld(), box); - if (!armorStands.isEmpty() && armorStands.get(0).getName().getString().contains("✯")) return true; + if (!armorStands.isEmpty() && armorStands.get(0).getName().getString().contains("✯")) return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow; } // Bats - return entity instanceof BatEntity; + return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow && entity instanceof BatEntity; } return false; diff --git a/src/main/resources/assets/skyblocker/lang/en_ca.json b/src/main/resources/assets/skyblocker/lang/en_ca.json index 5ecbd67638..883de5dcc7 100644 --- a/src/main/resources/assets/skyblocker/lang/en_ca.json +++ b/src/main/resources/assets/skyblocker/lang/en_ca.json @@ -2,8 +2,8 @@ "text.autoconfig.skyblocker.option.general.bars": "Health, Mana, Defence & XP Bars", "text.autoconfig.skyblocker.option.locations.dungeons.croesusHelper.@Tooltip": "Grey out chests that have already been opened.", "text.autoconfig.skyblocker.option.locations.dungeons.lividColor": "Livid Colour", - "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColor": "Enable Livid Colour", - "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColor.@Tooltip": "Send the livid colour in the chat during the Livid boss fight.", + "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColorText": "Enable Livid Colour", + "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColorText.@Tooltip": "Send the livid colour in the chat during the Livid boss fight.", "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.lividColorText": "Livid Colour 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 colour.", "text.autoconfig.skyblocker.option.locations.dungeons.terminals.solveColor": "Solve Select Coloured", diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index f4154b54d7..0e95550d68 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -199,8 +199,10 @@ "text.autoconfig.skyblocker.option.locations.dungeons.solveTicTacToe": "Solve Tic Tac Toe Puzzle", "text.autoconfig.skyblocker.option.locations.dungeons.solveTicTacToe.@Tooltip": "Puts a red box around the next best move for you to make!", "text.autoconfig.skyblocker.option.locations.dungeons.lividColor": "Livid Color", - "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.enableLividColorGlow": "Enable Livid Color Glow", + "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColorGlow.@Tooltip": "Applies the glowing effect to the correct Livid in F5/M5.", + "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColorText": "Enable Livid Color Text", + "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColorText.@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", diff --git a/src/main/resources/assets/skyblocker/lang/fr_fr.json b/src/main/resources/assets/skyblocker/lang/fr_fr.json index 207852ac61..a08371b3eb 100644 --- a/src/main/resources/assets/skyblocker/lang/fr_fr.json +++ b/src/main/resources/assets/skyblocker/lang/fr_fr.json @@ -67,8 +67,8 @@ "text.autoconfig.skyblocker.option.locations.dungeons.mapScaling": "Taille de la Carte", "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.lividColorText.@Tooltip": "Texte qui sera envoyé dans le chat lors du boss Livid. Le string \"[color]\" sera remplacé par la couleur Livid.", "text.autoconfig.skyblocker.option.locations.dungeons.lividColor": "Couleur Livid", - "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColor": "Activer la Couleur Livid", - "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColor.@Tooltip": "Envoyer la Couler Livid dans le chat durant le boss Livid.", + "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColorText": "Activer la Couleur Livid", + "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColorText.@Tooltip": "Envoyer la Couler Livid dans le chat durant le boss Livid.", "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.lividColorText": "Texte de la Couleur Livid", "text.autoconfig.skyblocker.option.general.bars.barpositions.LAYER1": "Couche 1", "text.autoconfig.skyblocker.option.general.bars.barpositions.NONE": "Désactivé", diff --git a/src/main/resources/assets/skyblocker/lang/pt_br.json b/src/main/resources/assets/skyblocker/lang/pt_br.json index d0371642e6..f636298650 100644 --- a/src/main/resources/assets/skyblocker/lang/pt_br.json +++ b/src/main/resources/assets/skyblocker/lang/pt_br.json @@ -184,7 +184,7 @@ "text.autoconfig.skyblocker.option.locations.dungeons.enableMap": "Ativar mapa", "text.autoconfig.skyblocker.option.locations.dungeons.mapScaling": "Tamanho do mapa", "text.autoconfig.skyblocker.option.locations.dungeons.lividColor": "Cor do Livid", - "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColor": "Ativar cor para Livid", + "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColorText": "Ativar cor para Livid", "text.autoconfig.skyblocker.option.locations.dungeons.terminals": "Guia dos terminais", "text.autoconfig.skyblocker.option.locations.dungeons.terminals.solveColor": "Guia de seleção colorido", "text.autoconfig.skyblocker.option.locations.dungeons.terminals.solveOrder": "Guia de clique em ordem", @@ -238,5 +238,5 @@ "text.autoconfig.skyblocker.option.locations.dungeons.starredMobGlow": "Brilho em Mobs com estrela", "text.autoconfig.skyblocker.option.locations.dungeons.starredMobGlow.@Tooltip": "Aplicar o efeito de brilho para Mobs estrelados que estão visíveis.", "text.autoconfig.skyblocker.option.locations.dungeons.solveTicTacToe": "Guia para o Puzzle do jogo da velha", - "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColor.@Tooltip": "Mandar a cor do Livid no chat durante a luta contra Livid." + "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColorText.@Tooltip": "Mandar a cor do Livid no chat durante a luta contra Livid." } diff --git a/src/main/resources/assets/skyblocker/lang/ru_ru.json b/src/main/resources/assets/skyblocker/lang/ru_ru.json index 980c130a38..d22f6274fe 100644 --- a/src/main/resources/assets/skyblocker/lang/ru_ru.json +++ b/src/main/resources/assets/skyblocker/lang/ru_ru.json @@ -82,9 +82,9 @@ "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.lividColorText.@Tooltip": "Текст, который будет отправлен в чат во время боя с Livid. Вместо \"[color]\" отправится цвет босса.", "text.autoconfig.skyblocker.option.locations.dwarvenMines.dwarvenHud.style.@Tooltip[1]": "\nКрасивый: Показывает название, процент и шкалу выполнения, а также иконку.", "text.autoconfig.skyblocker.option.locations.dungeons.mapScaling": "Размер Карты", - "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColor": "Включить Цвет Босса Livid", + "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColorText": "Включить Цвет Босса Livid", "text.autoconfig.skyblocker.option.locations.dungeons.lividColor": "Цвет Босса Livid", - "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColor.@Tooltip": "Отправляет в чат информацию о том, какого цвета босс Livid.", + "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColorText.@Tooltip": "Отправляет в чат информацию о том, какого цвета босс Livid.", "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.lividColorText": "Текст О Цвете Livid", "text.autoconfig.skyblocker.option.locations.dwarvenMines.dwarvenHud.style": "Стиль HUD", "text.autoconfig.skyblocker.option.locations.dwarvenMines.dwarvenHud.style.@Tooltip[0]": "Упрощенный: Показывает название и процент выполнения.", diff --git a/src/main/resources/assets/skyblocker/lang/zh_cn.json b/src/main/resources/assets/skyblocker/lang/zh_cn.json index 4a3abde3e7..9f8bb08caa 100644 --- a/src/main/resources/assets/skyblocker/lang/zh_cn.json +++ b/src/main/resources/assets/skyblocker/lang/zh_cn.json @@ -88,9 +88,9 @@ "text.autoconfig.skyblocker.option.general.fishing": "钓鱼助手", "text.autoconfig.skyblocker.option.general.fishing.enableFishingHelper": "启用钓鱼助手", "skyblocker.fishing.reelNow": "收竿!", - "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColor": "启用真 Livid 的颜色提示", + "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColorText": "启用真 Livid 的颜色提示", "text.autoconfig.skyblocker.option.locations.dungeons.lividColor": "提示真 Livid 的颜色", - "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColor.@Tooltip": "将真 Livid 的颜色发送到聊天栏。", + "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.enableLividColorText.@Tooltip": "将真 Livid 的颜色发送到聊天栏。", "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.lividColorText": "真 Livid 颜色提示信息", "text.autoconfig.skyblocker.option.locations.dungeons.lividColor.lividColorText.@Tooltip": "Livid Boss战时发送到聊天栏的信息, 字段 “[color]” 将被替换为真 Livid 的颜色", "key.skyblocker.defaultTgl": "将tab键所显示的列表改为默认空岛生存列表", From e066cf77479c374c3f2f62f44c42204d69846db0 Mon Sep 17 00:00:00 2001 From: Kevin <92656833+kevinthegreat1@users.noreply.github.com> Date: Sun, 5 Nov 2023 10:47:33 -0500 Subject: [PATCH 6/6] Update starred mob glow localization --- src/main/resources/assets/skyblocker/lang/en_us.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 0e95550d68..c51c035f17 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -189,7 +189,7 @@ "text.autoconfig.skyblocker.option.locations.dungeons.mapScreen": "Dungeon Map Placement Config...", "text.autoconfig.skyblocker.option.locations.dungeons.mapScaling": "Map Scaling", "text.autoconfig.skyblocker.option.locations.dungeons.starredMobGlow": "Starred Mob Glow", - "text.autoconfig.skyblocker.option.locations.dungeons.starredMobGlow.@Tooltip": "Applies the glowing effect to starred mobs that are visible. Also applies it to the correct Livid in F5/M5.", + "text.autoconfig.skyblocker.option.locations.dungeons.starredMobGlow.@Tooltip": "Applies the glowing effect to starred mobs that are visible.", "text.autoconfig.skyblocker.option.locations.dungeons.solveThreeWeirdos": "Solve Three Weirdos Puzzle", "text.autoconfig.skyblocker.option.locations.dungeons.blazeSolver": "Solve Blaze Puzzle", "text.autoconfig.skyblocker.option.locations.dungeons.blazeSolver.@Tooltip": "Boxes the correct blaze in green, also draws a line to and boxes the next blaze to kill in white.",