From 87fcbf95725a8fec8028f8d2eca61030e156ff6f Mon Sep 17 00:00:00 2001 From: Aaron <51387595+AzureAaron@users.noreply.github.com> Date: Wed, 31 Jul 2024 15:10:52 -0400 Subject: [PATCH] Implement Mr. Cat's suggestions --- .../crimson/kuudra/DangerWarning.java | 21 ++++++++----------- .../skyblock/crimson/kuudra/Kuudra.java | 4 +++- .../skyblock/crimson/kuudra/KuudraGlow.java | 12 ----------- .../skyblocker/skyblock/entity/MobGlow.java | 4 ++-- 4 files changed, 14 insertions(+), 27 deletions(-) delete mode 100644 src/main/java/de/hysky/skyblocker/skyblock/crimson/kuudra/KuudraGlow.java diff --git a/src/main/java/de/hysky/skyblocker/skyblock/crimson/kuudra/DangerWarning.java b/src/main/java/de/hysky/skyblocker/skyblock/crimson/kuudra/DangerWarning.java index 91ef557679..feaa1a111f 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/crimson/kuudra/DangerWarning.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/crimson/kuudra/DangerWarning.java @@ -2,8 +2,6 @@ import java.util.function.Supplier; -import org.apache.commons.lang3.ObjectUtils; - import de.hysky.skyblocker.config.SkyblockerConfigManager; import de.hysky.skyblocker.utils.Utils; import de.hysky.skyblocker.utils.render.RenderHelper; @@ -32,18 +30,17 @@ static void init() { private static void updateIndicator() { if (Utils.isInKuudra() && SkyblockerConfigManager.get().crimsonIsle.kuudra.dangerWarning && CLIENT.player != null && CLIENT.world != null) { - BlockPos under = CLIENT.player.getBlockPos().down(); - BlockPos under2 = CLIENT.player.getBlockPos().down(2); - BlockPos under3 = CLIENT.player.getBlockPos().down(3); - BlockPos under4 = CLIENT.player.getBlockPos().down(4); - BlockPos under5 = CLIENT.player.getBlockPos().down(5); + for (int i = 1; i <= 5; i++) { + BlockPos under = CLIENT.player.getBlockPos().down(i); + Title title = getDangerTitle(under); - Title title = ObjectUtils.firstNonNull(getDangerTitle(under), getDangerTitle(under2), getDangerTitle(under3), getDangerTitle(under4), getDangerTitle(under5)); + if (title != null) { + RenderHelper.displayInTitleContainerAndPlaySound(title); - if (title != null) { - RenderHelper.displayInTitleContainerAndPlaySound(title); - } else { - TitleContainer.removeTitle(TITLE); + return; + } else if (i == 5) { //Prevent removing the title prematurely + TitleContainer.removeTitle(TITLE); + } } } } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/crimson/kuudra/Kuudra.java b/src/main/java/de/hysky/skyblocker/skyblock/crimson/kuudra/Kuudra.java index f6a25b8432..626905a538 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/crimson/kuudra/Kuudra.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/crimson/kuudra/Kuudra.java @@ -6,7 +6,9 @@ import net.minecraft.text.Text; import net.minecraft.util.Formatting; -public class Kuudra { +public class Kuudra { + public static final int KUUDRA_MAGMA_CUBE_SIZE = 30; + static KuudraPhase phase = KuudraPhase.OTHER; public static void init() { diff --git a/src/main/java/de/hysky/skyblocker/skyblock/crimson/kuudra/KuudraGlow.java b/src/main/java/de/hysky/skyblocker/skyblock/crimson/kuudra/KuudraGlow.java deleted file mode 100644 index 0b9b88d800..0000000000 --- a/src/main/java/de/hysky/skyblocker/skyblock/crimson/kuudra/KuudraGlow.java +++ /dev/null @@ -1,12 +0,0 @@ -package de.hysky.skyblocker.skyblock.crimson.kuudra; - -import de.hysky.skyblocker.config.SkyblockerConfigManager; -import net.minecraft.entity.mob.MagmaCubeEntity; - -public class KuudraGlow { - private static final int KUUDRA_SIZE = 30; - - public static boolean shouldGlow(MagmaCubeEntity magmaCube, String name) { - return SkyblockerConfigManager.get().crimsonIsle.kuudra.kuudraGlow && magmaCube.getSize() == KUUDRA_SIZE && !name.equals("jeb_"); - } -} diff --git a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java index 3aa62a3bab..22474cf8be 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java @@ -3,7 +3,7 @@ import com.google.common.collect.Streams; import de.hysky.skyblocker.config.SkyblockerConfigManager; import de.hysky.skyblocker.skyblock.crimson.dojo.DojoManager; -import de.hysky.skyblocker.skyblock.crimson.kuudra.KuudraGlow; +import de.hysky.skyblocker.skyblock.crimson.kuudra.Kuudra; import de.hysky.skyblocker.skyblock.dungeon.LividColor; import de.hysky.skyblocker.skyblock.end.TheEnd; import de.hysky.skyblocker.utils.ItemUtils; @@ -70,7 +70,7 @@ public static boolean shouldMobGlow(Entity entity) { case ZombieEntity zombie when Utils.isInCrimson() && DojoManager.inArena -> DojoManager.shouldGlow(getArmorStandName(zombie)); //Kuudra - case MagmaCubeEntity magmaCube when Utils.isInKuudra() -> KuudraGlow.shouldGlow(magmaCube, name); + case MagmaCubeEntity magmaCube when Utils.isInKuudra() -> SkyblockerConfigManager.get().crimsonIsle.kuudra.kuudraGlow && magmaCube.getSize() == Kuudra.KUUDRA_MAGMA_CUBE_SIZE; default -> false; };