From 9946e80fa0fb5da41c4ad8e5ace2edad6c519167 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 1 Oct 2022 13:17:34 +0200 Subject: add all particles to hide in ashfang and blaze features --- .../features/slayer/blaze/BlazeSlayerClearView.kt | 97 ++++++++-------------- 1 file changed, 35 insertions(+), 62 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/slayer') diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt index c2036984b..b595f3cfa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt @@ -3,91 +3,64 @@ package at.hannibal2.skyhanni.features.slayer.blaze import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.PlayParticleEvent +import at.hannibal2.skyhanni.events.SpawnParticleEvent import at.hannibal2.skyhanni.features.damageindicator.BossType import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.getLorenzVec import net.minecraft.entity.projectile.EntityFireball -import net.minecraft.util.EnumParticleTypes -import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent class BlazeSlayerClearView { - private val hiddenFireBalls = mutableListOf() + var tick = 0 + var hideParticles = false @SubscribeEvent - fun onChatPacket(event: PlayParticleEvent) { - if (!isEnabled()) return - - when (event.type) { - EnumParticleTypes.SPELL_MOB, - EnumParticleTypes.REDSTONE, - EnumParticleTypes.FLAME, - -> { - } - - else -> return - } - - val bossLocations = DamageIndicatorManager.getBosses() - .filter { isBlazeBoss(it.bossType) } - .map { it.entity.getLorenzVec() } - val location = event.location - if (bossLocations.any { it.distance(location) < 3 }) { - event.isCanceled = true + fun onTick(event: TickEvent.ClientTickEvent) { + if (!LorenzUtils.inSkyblock) return + if (tick++ % 60 == 0) { + hideParticles = DamageIndicatorManager.getDistanceTo( + BossType.SLAYER_BLAZE_1, + BossType.SLAYER_BLAZE_2, + BossType.SLAYER_BLAZE_3, + BossType.SLAYER_BLAZE_4, + BossType.SLAYER_BLAZE_TYPHOEUS_1, + BossType.SLAYER_BLAZE_TYPHOEUS_2, + BossType.SLAYER_BLAZE_TYPHOEUS_3, + BossType.SLAYER_BLAZE_TYPHOEUS_4, + BossType.SLAYER_BLAZE_QUAZII_1, + BossType.SLAYER_BLAZE_QUAZII_2, + BossType.SLAYER_BLAZE_QUAZII_3, + BossType.SLAYER_BLAZE_QUAZII_4, + ) < 10 } } @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { - if (!isEnabled()) return - - val entity = event.entity - if (entity !is EntityFireball) return - - if (entity in hiddenFireBalls) { + fun onReceivePacket(event: PlayParticleEvent) { + if (isEnabled()) { event.isCanceled = true - return } + } - val bossLocations = DamageIndicatorManager.getBosses() - .filter { isBlazeBoss(it.bossType) } - .map { it.entity.getLorenzVec() } - - val location = entity.getLorenzVec() - if (bossLocations.any { it.distance(location) < 5 }) { - hiddenFireBalls.add(entity) + @SubscribeEvent + fun onSpawnParticle(event: SpawnParticleEvent) { + if (isEnabled()) { event.isCanceled = true } } - private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.slayer.blazeClearView - } - @SubscribeEvent - fun onWorldChange(event: WorldEvent.Load) { - hiddenFireBalls.clear() + fun onCheckRender(event: CheckRenderEntityEvent<*>) { + if (isEnabled()) { + if (event.entity is EntityFireball) { + event.isCanceled = true + } + } } - private fun isBlazeBoss(type: BossType): Boolean { - return when (type) { - BossType.SLAYER_BLAZE_1, - BossType.SLAYER_BLAZE_2, - BossType.SLAYER_BLAZE_3, - BossType.SLAYER_BLAZE_4, - BossType.SLAYER_BLAZE_TYPHOEUS_1, - BossType.SLAYER_BLAZE_TYPHOEUS_2, - BossType.SLAYER_BLAZE_TYPHOEUS_3, - BossType.SLAYER_BLAZE_TYPHOEUS_4, - BossType.SLAYER_BLAZE_QUAZII_1, - BossType.SLAYER_BLAZE_QUAZII_2, - BossType.SLAYER_BLAZE_QUAZII_3, - BossType.SLAYER_BLAZE_QUAZII_4, - -> true - - else -> false - } + private fun isEnabled(): Boolean { + return LorenzUtils.inSkyblock && SkyHanniMod.feature.slayer.blazeClearView && hideParticles } } \ No newline at end of file -- cgit