diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-10-01 13:17:34 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-10-01 13:17:34 +0200 |
commit | 9946e80fa0fb5da41c4ad8e5ace2edad6c519167 (patch) | |
tree | cb9d11ae19767a47739f74f553a89657c2796016 /src/main/java/at/hannibal2/skyhanni/features/slayer | |
parent | 0185d2cfdceb33c3f72f79f6e119b896f56b7a79 (diff) | |
download | skyhanni-9946e80fa0fb5da41c4ad8e5ace2edad6c519167.tar.gz skyhanni-9946e80fa0fb5da41c4ad8e5ace2edad6c519167.tar.bz2 skyhanni-9946e80fa0fb5da41c4ad8e5ace2edad6c519167.zip |
add all particles to hide in ashfang and blaze features
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/slayer')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt | 97 |
1 files changed, 35 insertions, 62 deletions
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<EntityFireball>() + 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 |