aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt12
3 files changed, 12 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt
index f569a0f21..ee80ab77b 100755
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt
@@ -38,8 +38,8 @@ class GardenYawAndPitch {
if (!config.showAlways && System.currentTimeMillis() > lastChange + (config.timeout * 1000)) return
val displayList = listOf(
- "§aYaw: §f${yaw.toDouble().round(config.yawPrecision)}",
- "§aPitch: §f${pitch.toDouble().round(config.pitchPrecision)}",
+ "§aYaw: §f${yaw.round(config.yawPrecision)}",
+ "§aPitch: §f${pitch.round(config.pitchPrecision)}",
)
if (GardenAPI.inGarden()) {
config.pos.renderStrings(displayList, posLabel = "Yaw and Pitch")
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 c4e0cbb26..f09e86164 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
@@ -139,7 +139,7 @@ class ItemAbilityCooldown {
}
}
if (event.soundName == "random.drink") {
- if (event.pitch.round(1) == 1.8 && event.volume == 1.0f) {
+ if (event.pitch.round(1) == 1.8f && 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 08f88ea17..248efd5df 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -119,13 +119,19 @@ object LorenzUtils {
fun Double.round(decimals: Int): Double {
var multiplier = 1.0
repeat(decimals) { multiplier *= 10 }
- return kotlin.math.round(this * multiplier) / multiplier
+ val result = kotlin.math.round(this * multiplier) / multiplier
+ val a = result.toString()
+ val b = toString()
+ return if (a.length > b.length) this else result
}
- fun Float.round(decimals: Int): Double {
+ fun Float.round(decimals: Int): Float {
var multiplier = 1.0
repeat(decimals) { multiplier *= 10 }
- return kotlin.math.round(this * multiplier) / multiplier
+ val result = kotlin.math.round(this * multiplier) / multiplier
+ val a = result.toString()
+ val b = toString()
+ return if (a.length > b.length) this else result.toFloat()
}
// TODO replace all calls with regex