From d16891c6c1e46ca8356deb5685f1551e32ecee45 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 23 Apr 2023 16:52:17 +0200 Subject: Only show mushroom cow perk eta when block speed is loaded --- .../garden/farming/GardenCropMilestoneDisplay.kt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt index 4a12ac29d..02172ac8e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt @@ -340,12 +340,6 @@ class GardenCropMilestoneDisplay { val missing = need - have - val blocksPerSecond = averageBlocksPerSecond * (currentCrop?.multiplier ?: 1) - - val missingTimeSeconds = missing / blocksPerSecond - val millis = missingTimeSeconds * 1000 - val duration = TimeUtils.formatDuration(millis.toLong()) - lineMap[0] = Collections.singletonList("§6Mooshroom Cow Perk") val list = mutableListOf() @@ -354,7 +348,16 @@ class GardenCropMilestoneDisplay { lineMap[1] = list lineMap[2] = Collections.singletonList("§e$haveFormat§8/§e$needFormat") - lineMap[3] = Collections.singletonList("§7In §b$duration") + + + if (averageBlocksPerSecond != 0.0) { + val blocksPerSecond = averageBlocksPerSecond * (currentCrop?.multiplier ?: 1) + + val missingTimeSeconds = missing / blocksPerSecond + val millis = missingTimeSeconds * 1000 + val duration = TimeUtils.formatDuration(millis.toLong()) + lineMap[3] = Collections.singletonList("§7In §b$duration") + } val percentageFormat = LorenzUtils.formatPercentage(have.toDouble() / need.toDouble()) lineMap[4] = Collections.singletonList("§7Percentage: §e$percentageFormat") -- cgit