diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-22 21:20:03 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-22 21:20:03 +0200 |
commit | 7ec27bff0dc020c4a8e3174dbea2e89c9c910552 (patch) | |
tree | 5fdbe6c6cdff35ccfad5a7b02faf33d4906afbc4 | |
parent | 6f020d1cb58ed282c597ee2691b3c816b2f7b375 (diff) | |
download | skyhanni-7ec27bff0dc020c4a8e3174dbea2e89c9c910552.tar.gz skyhanni-7ec27bff0dc020c4a8e3174dbea2e89c9c910552.tar.bz2 skyhanni-7ec27bff0dc020c4a8e3174dbea2e89c9c910552.zip |
Fixed crop milestone inventory showing wrong level as stack size when maxed out.
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt | 14 |
1 files 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 (?<tier>.*): §e(?:.*)".toPattern() private var patternUpgradeTier = "§7Current Tier: §[ea](?<tier>.*)§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 +} |