From 202609cde2f74b7e6b789e2e5caa781a49ca7cdc Mon Sep 17 00:00:00 2001 From: CarsCupcake <84076092+CarsCupcake@users.noreply.github.com> Date: Sat, 6 Apr 2024 01:20:46 +0200 Subject: Feature: Shadow Assassin Jump Notification (#852) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Linnea Gräf Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: Cal --- .../dungeon/DungeonShadowAssassinNotification.kt | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonShadowAssassinNotification.kt (limited to 'src/main/java/at/hannibal2/skyhanni/features/dungeon') diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonShadowAssassinNotification.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonShadowAssassinNotification.kt new file mode 100644 index 000000000..26144f940 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonShadowAssassinNotification.kt @@ -0,0 +1,32 @@ +package at.hannibal2.skyhanni.features.dungeon + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.TitleManager +import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.mixins.transformers.AccessorWorldBoarderPacket +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.SoundUtils +import net.minecraft.network.play.server.S44PacketWorldBorder +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.seconds + +class DungeonShadowAssassinNotification { + private val config get() = SkyHanniMod.feature.dungeon + + @SubscribeEvent + fun onWorldBoarderChange(event: PacketEvent.ReceiveEvent) { + if (!isEnabled()) return + if (DungeonAPI.dungeonFloor?.contains("3") == true && DungeonAPI.inBossRoom) return + + val packet = event.packet as? AccessorWorldBoarderPacket ?: return + val action = packet.action + val warningTime = packet.warningTime + + if (action == S44PacketWorldBorder.Action.INITIALIZE && warningTime == 10000) { + TitleManager.sendTitle("§cShadow Assassin Jumping!", 2.seconds, 3.6, 7.0f) + SoundUtils.playBeepSound() + } + } + + private fun isEnabled() = LorenzUtils.inDungeons && config.shadowAssassinJumpNotifier +} -- cgit