From 01d4aef89b7fdad58a320cf1eb4e478ac12aaba4 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 15 Sep 2022 22:49:58 +0200 Subject: added and used events for particle and sound --- .../features/nether/ashfang/AshfangHideParticles.kt | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/nether') diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt index 07dc6d305..419f82486 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt @@ -1,26 +1,20 @@ package at.hannibal2.skyhanni.features.nether.ashfang import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.events.PlayParticleEvent import at.hannibal2.skyhanni.features.damageindicator.BossType import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager import at.hannibal2.skyhanni.utils.LorenzUtils -import net.minecraft.network.play.server.S2APacketParticles import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AshfangHideParticles { @SubscribeEvent - fun onReceivePacket(event: PacketEvent.ReceiveEvent) { - if (event.packet !is S2APacketParticles) return - - if (isEnabled()) { + fun onReceivePacket(event: PlayParticleEvent) { + if (LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.hideParticles && + DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) + ) { event.isCanceled = true } } - - private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.hideParticles && - DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) - } } \ No newline at end of file -- cgit