From 317fcbd610df900401b534db06b899d837413725 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 20 Apr 2023 01:20:24 +0200 Subject: Added support for hoe counter and cultivating ove 1b --- src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt | 2 +- .../features/garden/farming/GardenCropMilestoneDisplay.kt | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt index d6ffa41ab..46f7c1fe1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -109,7 +109,7 @@ object GardenAPI { return CropType.values().firstOrNull { internalName.startsWith(it.toolName) } } - fun readCounter(itemStack: ItemStack): Int = itemStack.getHoeCounter() ?: itemStack.getCultivatingCounter() ?: -1 + fun readCounter(itemStack: ItemStack): Long = itemStack.getHoeCounter() ?: itemStack.getCultivatingCounter() ?: -1L fun CropType.getSpeed(): Int { val speed = cropsPerSecond[this] 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 7b644578a..fbefe574a 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 @@ -29,7 +29,7 @@ import kotlin.concurrent.fixedRateTimer class GardenCropMilestoneDisplay { private var progressDisplay = listOf>() private var mushroomCowPerkDisplay = listOf>() - private val cultivatingData = mutableMapOf() + private val cultivatingData = mutableMapOf() private val config get() = SkyHanniMod.feature.garden private val bestCropTime = GardenBestCropTime() // val cropMilestoneLevelUpPattern = Pattern.compile(" §r§b§lGARDEN MILESTONE §3(.*) §8XXIII➜§3(.*)") @@ -117,11 +117,11 @@ class GardenCropMilestoneDisplay { try { val item = event.itemStack val counter = GardenAPI.readCounter(item) - if (counter == -1) return + if (counter == -1L) return val crop = item.getCropType() ?: return if (cultivatingData.containsKey(crop)) { val old = cultivatingData[crop]!! - val addedCounter = counter - old + val addedCounter = (counter - old).toInt() if (GardenCropMilestones.cropCounter.isEmpty()) { for (innerCrop in CropType.values()) { @@ -283,7 +283,7 @@ class GardenCropMilestoneDisplay { lineMap[2] = Collections.singletonList("§e$haveFormat§8/§e$needFormat") lastItemInHand?.let { - if (GardenAPI.readCounter(it) == -1) { + if (GardenAPI.readCounter(it) == -1L) { lineMap[3] = Collections.singletonList("§cWarning: You need Cultivating!") return formatDisplay(lineMap) } -- cgit