From 2f01e188d9738479f5bf8b7d808296d02d51af6a Mon Sep 17 00:00:00 2001 From: zgordonksu Date: Fri, 23 Jan 2026 20:20:46 -0500 Subject: [PATCH] Add MiniBoss Alert. Remove useless Blaze Features --- .../dev/oblongboot/sxp/Slayerxpoverlay.kt | 1 + .../oblongboot/sxp/features/MiniBossAlert.kt | 41 ++++++++++++++ .../oblongboot/sxp/settings/FeatureManager.kt | 2 +- .../dev/oblongboot/sxp/ui/SettingsScreen.kt | 55 +++++++++++-------- .../dev/oblongboot/sxp/utils/BossDetection.kt | 17 +++--- 5 files changed, 85 insertions(+), 31 deletions(-) create mode 100644 src/main/kotlin/dev/oblongboot/sxp/features/MiniBossAlert.kt diff --git a/src/main/kotlin/dev/oblongboot/sxp/Slayerxpoverlay.kt b/src/main/kotlin/dev/oblongboot/sxp/Slayerxpoverlay.kt index 023887b..a9c17ea 100644 --- a/src/main/kotlin/dev/oblongboot/sxp/Slayerxpoverlay.kt +++ b/src/main/kotlin/dev/oblongboot/sxp/Slayerxpoverlay.kt @@ -47,6 +47,7 @@ object Slayerxpoverlay : ModInitializer { EVENT_BUS.subscribe(onMessage()) EVENT_BUS.subscribe(dev.oblongboot.sxp.features.BossHighlightFeat()) EVENT_BUS.subscribe(dev.oblongboot.sxp.features.AutoCallMaddoxFeat()) + EVENT_BUS.subscribe(dev.oblongboot.sxp.features.MiniBossAlert()) APIUtils.getXP() APIUtils.startAutoXPUpdates() diff --git a/src/main/kotlin/dev/oblongboot/sxp/features/MiniBossAlert.kt b/src/main/kotlin/dev/oblongboot/sxp/features/MiniBossAlert.kt new file mode 100644 index 0000000..644e0b5 --- /dev/null +++ b/src/main/kotlin/dev/oblongboot/sxp/features/MiniBossAlert.kt @@ -0,0 +1,41 @@ +package dev.oblongboot.sxp.features + +import dev.oblongboot.sxp.events.OnPacket +import dev.oblongboot.sxp.settings.Config +import dev.oblongboot.sxp.utils.Scheduler +import meteordevelopment.orbit.EventHandler +import net.minecraft.client.MinecraftClient +import net.minecraft.sound.SoundCategory +import net.minecraft.sound.SoundEvents +import net.minecraft.text.Text +import net.minecraft.util.Formatting +import net.minecraft.network.packet.s2c.play.GameMessageS2CPacket + +class MiniBossAlert { + @EventHandler + fun onChatMessage(event: OnPacket.Incoming) { + val packet = event.packet + if (packet !is GameMessageS2CPacket) return + if (!Config.isToggled("MiniBossAlert")) return + val msg = packet.content().string.trim() + + val regex = Regex("SLAYER MINI-BOSS (.+) has spawned!") + val match = regex.find(msg) ?: return + val mini = match.groupValues[1] + + val client = MinecraftClient.getInstance() + val player = client.player ?: return + + client.execute { + client.inGameHud.setTitle( + Text.literal(mini).formatted(Formatting.DARK_RED, Formatting.BOLD) + ) + + client.inGameHud.setSubtitle(Text.empty()) + client.inGameHud.setTitleTicks(0, 25, 0) + + client.player?.playSound(SoundEvents.BLOCK_NOTE_BLOCK_PLING.value()) + } + + } +} \ No newline at end of file diff --git a/src/main/kotlin/dev/oblongboot/sxp/settings/FeatureManager.kt b/src/main/kotlin/dev/oblongboot/sxp/settings/FeatureManager.kt index 9dc34ed..915bd1e 100644 --- a/src/main/kotlin/dev/oblongboot/sxp/settings/FeatureManager.kt +++ b/src/main/kotlin/dev/oblongboot/sxp/settings/FeatureManager.kt @@ -63,7 +63,7 @@ object FeatureManager { } // I dont think this was implemented because it wasnt working for me - val knownSwitches = listOf("BurningVengeanceDamage", "BurningVengeanceTimer", "ShortPrefix", "IsGradient") + val knownSwitches = listOf("ShortPrefix", "IsGradient", "AutoCallMaddox", "MiniBossAlert") knownSwitches.forEach {switchName -> states[switchName] = Config.isToggled(switchName) } diff --git a/src/main/kotlin/dev/oblongboot/sxp/ui/SettingsScreen.kt b/src/main/kotlin/dev/oblongboot/sxp/ui/SettingsScreen.kt index 66c0788..f22510d 100644 --- a/src/main/kotlin/dev/oblongboot/sxp/ui/SettingsScreen.kt +++ b/src/main/kotlin/dev/oblongboot/sxp/ui/SettingsScreen.kt @@ -156,6 +156,17 @@ class SettingsScreen : Screen(Text.of("SlayerXPOverlay Config")) { y = yPos } elements.add(autoCallMaddox) + yPos += elementHeight + elementSpacing + 60 + + val miniBossAlert = SwitchConfig( + name = "MiniBossAlert", + default = false + ).apply { + x = sidebarWidth + 20 + y = yPos + } + elements.add(miniBossAlert) + yPos += elementHeight + elementSpacing + 60 // val HighlightsToggle = SwitchConfig( // name = "BossHighlight", @@ -171,28 +182,28 @@ class SettingsScreen : Screen(Text.of("SlayerXPOverlay Config")) { } - "Blaze" -> { - val BVDamage = SwitchConfig( - name = "BurningVengeanceDamage", - default = false, - description = "Says the Damage of your first Burning Vengeance Activation in chat" - ).apply { - x = sidebarWidth + 20 - y = yPos - } - elements.add(BVDamage) - yPos += elementHeight + elementSpacing + 60 - - val BVTimer = SwitchConfig( - name = "BurningVengeanceTimer", - default = false, - description = "Counts down the time until Burning Vengeance Activates" - ).apply { - x = sidebarWidth + 20 - y = yPos - } - elements.add(BVTimer) - } +// "Blaze" -> { +// val BVDamage = SwitchConfig( +// name = "BurningVengeanceDamage", +// default = false, +// description = "Says the Damage of your first Burning Vengeance Activation in chat" +// ).apply { +// x = sidebarWidth + 20 +// y = yPos +// } +// elements.add(BVDamage) +// yPos += elementHeight + elementSpacing + 60 +// +// val BVTimer = SwitchConfig( +// name = "BurningVengeanceTimer", +// default = false, +// description = "Counts down the time until Burning Vengeance Activates" +// ).apply { +// x = sidebarWidth + 20 +// y = yPos +// } +// elements.add(BVTimer) +// } "Colors" -> { val messageColorSelector1 = ColorboxSetting( diff --git a/src/main/kotlin/dev/oblongboot/sxp/utils/BossDetection.kt b/src/main/kotlin/dev/oblongboot/sxp/utils/BossDetection.kt index e6377d0..2088f79 100644 --- a/src/main/kotlin/dev/oblongboot/sxp/utils/BossDetection.kt +++ b/src/main/kotlin/dev/oblongboot/sxp/utils/BossDetection.kt @@ -55,19 +55,19 @@ fun bossChecker(sw: StopwatchUtil, lastUUID: Array) { lastUUID[0] = stand.uuid.toString(); val cSlayer = Scoreboard.getSlayerType() - // Add config checks after they are made - if (cSlayer == "Blaze" && Config.isToggled("BurningVengeanceDamage")) { - burningDamage(); - } - if (cSlayer == "Blaze" && Config.isToggled("BurningVengeanceTimer")) { - burningTimer(pName); - } + // Discontinued features. Keeping just in case its somehow used again +// if (cSlayer == "Blaze" && Config.isToggled("BurningVengeanceDamage")) { +// burningDamage(); +// } +// if (cSlayer == "Blaze" && Config.isToggled("BurningVengeanceTimer")) { +// burningTimer(pName); +// } break; } } }); } - +// Discontinued due to being useless fun burningDamage() { var running = true; @@ -85,6 +85,7 @@ fun burningDamage() { }); } +// Discontinued due to being useless fun burningTimer(pName: String?) { var running = true;