From 624bad4f41f62e58b3c3922eddf54944181d4b6e Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:13:58 +0100 Subject: Hide particles and damage splashes during terracotta phase in dungeon F6/M6. --- .../skyhanni/features/dungeon/TerracottaPhase.kt | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/dungeon/TerracottaPhase.kt (limited to 'src/main/java/at/hannibal2/skyhanni/features') diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/TerracottaPhase.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/TerracottaPhase.kt new file mode 100644 index 000000000..9cc992922 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/TerracottaPhase.kt @@ -0,0 +1,49 @@ +package at.hannibal2.skyhanni.features.dungeon + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.events.ReceiveParticleEvent +import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.entity.EntityLivingBase +import net.minecraftforge.client.event.RenderLivingEvent +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class TerracottaPhase { + private val config get() = SkyHanniMod.feature.dungeon.terracottaPhase + + private var inTerracottaPhase = false + + @SubscribeEvent + fun onChat(event: LorenzChatEvent) { + if (!isEnabled()) return + + if (event.message == "§c[BOSS] Sadan§r§f: So you made it all the way here... Now you wish to defy me? Sadan?!") { + inTerracottaPhase = true + } + + if (event.message == "§c[BOSS] Sadan§r§f: ENOUGH!") { + inTerracottaPhase = false + } + } + + @SubscribeEvent(priority = EventPriority.HIGH) + fun onRenderLiving(event: RenderLivingEvent.Specials.Pre) { + if (isActive() && config.hideDamageSplash && DamageIndicatorManager.isDamageSplash(event.entity)) { + event.isCanceled = true + } + } + + @SubscribeEvent + fun onReceiveParticle(event: ReceiveParticleEvent) { + if (isActive() && config.hideParticles) { + event.isCanceled = true + } + } + + private fun isActive() = isEnabled() && inTerracottaPhase + + private fun isEnabled() = + LorenzUtils.inDungeons && DungeonAPI.inBossRoom && DungeonAPI.getCurrentBoss() == DungeonAPI.DungeonFloor.F6 +} -- cgit