diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-03 17:34:18 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-03 17:34:18 +0200 |
commit | 559cceb47fb24eb7b7ed0a28174c483570f9792a (patch) | |
tree | b2e5e527cb4487f90033e1aa3f98f30410f133f6 /src/main/java | |
parent | 354204bc99bfefc63da6dbd55e79e1d9d69a71f7 (diff) | |
download | skyhanni-559cceb47fb24eb7b7ed0a28174c483570f9792a.tar.gz skyhanni-559cceb47fb24eb7b7ed0a28174c483570f9792a.tar.bz2 skyhanni-559cceb47fb24eb7b7ed0a28174c483570f9792a.zip |
Fixed holy ice cooldown sometimes not working.
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt | 3 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt index 98bd41560..e15395d16 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt @@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.between import at.hannibal2.skyhanni.utils.LorenzUtils.equalsOneOf +import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getAbilityScrolls import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraft.client.Minecraft @@ -135,7 +136,7 @@ class ItemAbilityCooldown { } } if (event.soundName == "random.drink") { - if (event.pitch == 1.8888888f && event.volume == 1.0f) { + if (event.pitch.round(1).toDouble() == 1.8 && event.volume == 1.0f) { ItemAbility.HOLY_ICE.sound() } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 64281ddf8..4528f7ee5 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -116,6 +116,12 @@ object LorenzUtils { return kotlin.math.round(this * multiplier) / multiplier } + fun Float.round(decimals: Int): Double { + var multiplier = 1.0 + repeat(decimals) { multiplier *= 10 } + return kotlin.math.round(this * multiplier) / multiplier + } + // TODO replace all calls with regex fun String.between(start: String, end: String): String = this.split(start, end)[1] |