From 592a565cb0d030481e2e093f983c754600e288c1 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 30 Nov 2023 11:09:39 +0100 Subject: move pattern into member space --- .../skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt index 544ad6094..6f609def6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -43,9 +43,13 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object ItemDisplayOverlayFeatures { private val config get() = SkyHanniMod.feature.inventory + + // TODO repo private val rancherBootsSpeedCapPattern = "§7Current Speed Cap: §a(?.*)".toPattern() private val petLevelPattern = "\\[Lvl (?.*)] .*".toPattern() private val gardenVacuumPatterm = "§7Vacuum Bag: §6(?\\d*) Pests?".toPattern() + private val harvestPattern = "§7§7You may harvest §6(?.).*".toPattern() + private val dungeonPotionPattern = "Dungeon (?.*) Potion".toPattern() private val bottleOfJyrre = "NEW_BOTTLE_OF_JYRRE".asInternalName() @@ -161,7 +165,7 @@ object ItemDisplayOverlayFeatures { if (LARVA_HOOK.isSelected() && itemName.contains("Larva Hook")) { for (line in item.getLore()) { - "§7§7You may harvest §6(?.).*".toPattern().matchMatcher(line) { + harvestPattern.matchMatcher(line) { val amount = group("amount").toInt() return when { amount > 4 -> "§a$amount" @@ -174,7 +178,7 @@ object ItemDisplayOverlayFeatures { if (DUNGEON_POTION_LEVEL.isSelected() && itemName.startsWith("Dungeon ") && itemName.contains(" Potion")) { item.name?.let { - "Dungeon (?.*) Potion".toPattern().matchMatcher(it.removeColor()) { + dungeonPotionPattern.matchMatcher(it.removeColor()) { return when (val level = group("level").romanToDecimal()) { in 1..2 -> "§f$level" in 3..4 -> "§a$level" -- cgit