From e83fef331c43b19342bdf4c2e173683163f45abf Mon Sep 17 00:00:00 2001 From: HiZe_ Date: Tue, 25 Jul 2023 15:46:52 +0200 Subject: Added dungeon potion level to item number (#334) Co-authored-by: superhize --- .../at/hannibal2/skyhanni/config/features/Inventory.java | 3 ++- .../features/inventory/ItemDisplayOverlayFeatures.kt | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java index 2a98f94fc..ffa412aff 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java @@ -211,7 +211,8 @@ public class Inventory { "§bSkill Level", "§bCollection Level", "§bRancher's Boots speed", - "§bLarva Hook" + "§bLarva Hook", + "§bDungeon Potion Level" } ) public List itemNumberAsStackSize = new ArrayList<>(Arrays.asList(3, 9, 11, 12)); 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 2622c8f14..6fdb3800d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNeeded import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.matchRegex +import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -176,6 +177,21 @@ class ItemDisplayOverlayFeatures { } } + if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(13)) { + if (item.getInternalName() == "POTION") { + item.name?.let { + "Dungeon (?.*) Potion".toPattern().matchMatcher(it.removeColor()) { + return when (val level = group("level").romanToDecimal()) { + in 1..2 -> "§f$level" + in 3..4 -> "§a$level" + in 5..6 -> "§9$level" + else -> "§5$level" + } + } + } + } + } + return "" } -- cgit