diff options
Diffstat (limited to 'src')
4 files changed, 8 insertions, 11 deletions
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 5b8bc369d..729c4f85b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt @@ -649,7 +649,7 @@ class DamageIndicatorManager { else -> { LorenzUtils.error( "Unexpected health of thorn in f4! (${ - LorenzUtils.formatDouble(realHealth.toDouble()) + LorenzUtils.formatInteger(realHealth) })" ) return null diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt index 3b5b7834c..a8dda617d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt @@ -130,8 +130,8 @@ class EliteFarmingWeight { } } - val totalWeight = (cropWeight + bonusWeight).round(2) - return "§e" + LorenzUtils.formatDouble(totalWeight) + val totalWeight = (cropWeight + bonusWeight) + return "§e" + LorenzUtils.formatDouble(totalWeight, 2) } private fun isEnabled() = GardenAPI.inGarden() && config.eliteFarmingWeightDisplay diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt index 7251facb1..ea1ac0a82 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt @@ -6,7 +6,6 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.PlaySoundEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent import at.hannibal2.skyhanni.utils.* -import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraft.nbt.NBTTagCompound import net.minecraftforge.common.MinecraftForge @@ -106,9 +105,9 @@ class LorenzTest { fun copyLocation() { val location = LocationUtils.playerLocation() - val x = LorenzUtils.formatDouble(location.x.round(1), "0.0") - val y = LorenzUtils.formatDouble(location.y.round(1), "0.0") - val z = LorenzUtils.formatDouble(location.z.round(1), "0.0") + val x = LorenzUtils.formatDouble(location.x) + val y = LorenzUtils.formatDouble(location.y) + val z = LorenzUtils.formatDouble(location.z) OSUtils.copyToClipboard("LorenzVec($x, $y, $z)") } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 91430d923..b85250841 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -121,10 +121,8 @@ object LorenzUtils { fun formatInteger(l: Long): String = NumberFormat.getIntegerInstance().format(l) - fun formatDouble(d: Double, format: String?): String = - NumberFormat.getNumberInstance().format(d) - - fun formatDouble(d: Double): String = formatDouble(d, "#,##0.0") + fun formatDouble(d: Double, round: Int = 1): String = + NumberFormat.getNumberInstance().format(d.round(round)) fun consoleLog(text: String) { SkyHanniMod.consoleLog(text) |