aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt14
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
+}