From 7ec27bff0dc020c4a8e3174dbea2e89c9c910552 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 22 Oct 2023 21:20:03 +0200 Subject: Fixed crop milestone inventory showing wrong level as stack size when maxed out. --- .../features/garden/inventory/GardenInventoryNumbers.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt index c030d4087..fe3d690a3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt @@ -2,6 +2,8 @@ package at.hannibal2.skyhanni.features.garden.inventory import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.data.GardenCropMilestones +import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter import at.hannibal2.skyhanni.data.model.ComposterUpgrade import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.features.garden.GardenAPI @@ -15,7 +17,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class GardenInventoryNumbers { private val config get() = SkyHanniMod.feature.garden.number - private var patternTierProgress = "§7Progress to Tier (?.*): §e(?:.*)".toPattern() private var patternUpgradeTier = "§7Current Tier: §[ea](?.*)§7/§a.*".toPattern() @SubscribeEvent @@ -25,11 +26,10 @@ class GardenInventoryNumbers { if (InventoryUtils.openInventoryName() == "Crop Milestones") { if (!config.cropMilestone) return - event.stack.getLore() - .map { patternTierProgress.matcher(it) } - .filter { it.matches() } - .map { it.group("tier").romanToDecimalIfNeeded() - 1 } - .forEach { event.stackTip = "" + it } + val crop = GardenCropMilestones.getCropTypeByLore(event.stack) ?: return + val counter = crop.getCounter() + val currentTier = GardenCropMilestones.getTierForCropCount(counter, crop) + event.stackTip = "" + currentTier } if (InventoryUtils.openInventoryName() == "Crop Upgrades") { @@ -61,4 +61,4 @@ class GardenInventoryNumbers { event.move(3, "garden.numberComposterUpgrades", "garden.number.composterUpgrades") } -} \ No newline at end of file +} -- cgit