diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-02-13 16:53:31 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-02-13 16:53:31 +0100 |
commit | 2bf12758c3079abf2611156aa00ef226d5ee4f94 (patch) | |
tree | eeb8263eaceea72ffa7e2005b53ab2ce5c010885 /src | |
parent | c52c7d3d76015b95a97c0ebe3e78e40831f21a58 (diff) | |
download | skyhanni-2bf12758c3079abf2611156aa00ef226d5ee4f94.tar.gz skyhanni-2bf12758c3079abf2611156aa00ef226d5ee4f94.tar.bz2 skyhanni-2bf12758c3079abf2611156aa00ef226d5ee4f94.zip |
Code cleanup.
Diffstat (limited to 'src')
4 files changed, 15 insertions, 19 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt b/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt index 0312342da..273809ccb 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt @@ -93,7 +93,6 @@ class SkillExperience { next = false } } - } if (skillExp.isNotEmpty()) return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt index a18329f13..7390393d9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt @@ -70,13 +70,11 @@ class DamageIndicatorManager { fun getDistanceTo(vararg types: BossType): Double { val playerLocation = LocationUtils.playerLocation() - val list = - data.values.filter { it.bossType in types }.map { it.entity.getLorenzVec().distance(playerLocation) } - return if (list.isEmpty()) { - Double.MAX_VALUE - } else { - list.minOf { it } - } + return data.values.filter { it.bossType in types } + .map { it.entity.getLorenzVec().distance(playerLocation) } + .let { list -> + if (list.isEmpty()) Double.MAX_VALUE else list.minOf { it } + } } fun getNearestDistanceTo(location: LorenzVec): Double { 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 df242b159..03211eb5b 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 @@ -15,23 +15,22 @@ import net.minecraftforge.fml.common.gameevent.TickEvent class AshfangHideParticles { var tick = 0 - var hideParticles = false + private var nearAshfang = false @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { if (!LorenzUtils.inSkyBlock) return if (tick++ % 60 == 0) { - val distance = DamageIndicatorManager.getDistanceTo(BossType.NETHER_ASHFANG) - hideParticles = distance < 40 + nearAshfang = DamageIndicatorManager.getDistanceTo(BossType.NETHER_ASHFANG) < 40 } } @SubscribeEvent fun onReceivePacket(event: ReceiveParticleEvent) { - if (!isEnabled()) return - - event.isCanceled = true + if (isEnabled()) { + event.isCanceled = true + } } @SubscribeEvent(priority = EventPriority.HIGH) @@ -51,5 +50,5 @@ class AshfangHideParticles { } } - private fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.ashfang.hideParticles && hideParticles + private fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.ashfang.hideParticles && nearAshfang }
\ No newline at end of file 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 289377c83..6316361fb 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 @@ -13,13 +13,13 @@ import net.minecraftforge.fml.common.gameevent.TickEvent class BlazeSlayerClearView { private var tick = 0 - private var hideParticles = false + private var nearBlaze = false @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { if (!LorenzUtils.inSkyBlock) return if (tick++ % 60 == 0) { - hideParticles = DamageIndicatorManager.getDistanceTo( + nearBlaze = DamageIndicatorManager.getDistanceTo( BossType.SLAYER_BLAZE_1, BossType.SLAYER_BLAZE_2, BossType.SLAYER_BLAZE_3, @@ -32,7 +32,7 @@ class BlazeSlayerClearView { BossType.SLAYER_BLAZE_QUAZII_2, BossType.SLAYER_BLAZE_QUAZII_3, BossType.SLAYER_BLAZE_QUAZII_4, - ) < 20 + ) < 10 } } @@ -54,6 +54,6 @@ class BlazeSlayerClearView { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyBlock && SkyHanniMod.feature.slayer.blazeClearView && hideParticles + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.slayer.blazeClearView && nearBlaze } }
\ No newline at end of file |