From 62e6776252ef991bd1387d7b9d1c4a417f4bbb2f Mon Sep 17 00:00:00 2001 From: Walker Selby Date: Wed, 13 Dec 2023 16:04:59 -0800 Subject: Fix: Modify ItemStack ranchers boot check to use NBT (#795) Fixed rancher boots speed stack size. #795 --- .../skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt | 11 +++++++---- .../at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src/main') 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 6df462af1..e3ba427f7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -20,6 +20,7 @@ import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumbe import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.RANCHERS_BOOTS_SPEED import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.SKILL_LEVEL import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.VACUUM_GARDEN +import at.hannibal2.skyhanni.data.PetAPI import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.features.garden.pests.PestAPI import at.hannibal2.skyhanni.utils.ConfigUtils @@ -37,6 +38,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getBottleOfJyrreSeconds import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getEdition +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getRanchersSpeed import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraft.item.ItemStack @@ -47,7 +49,6 @@ 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 masterSkullPattern = "(.*)Master Skull - Tier .".toPattern() private val gardenVacuumPatterm = "§7Vacuum Bag: §6(?\\d*) Pests?".toPattern() @@ -163,10 +164,12 @@ object ItemDisplayOverlayFeatures { } if (RANCHERS_BOOTS_SPEED.isSelected() && itemName.contains("Rancher's Boots")) { - for (line in item.getLore()) { - rancherBootsSpeedCapPattern.matchMatcher(line) { - return group("cap") + val ranchersSpeed = item.getRanchersSpeed() + if (ranchersSpeed != null) { + if (ranchersSpeed > 400 && PetAPI.currentPet?.contains("Black Cat") == false) { + return "§c" + ranchersSpeed.toString() } + return "§a" + ranchersSpeed.toString() } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt index 9db592047..82a6b076f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt @@ -121,6 +121,8 @@ object SkyBlockItemModifierUtils { fun ItemStack.getFungiCutterMode() = getAttributeString("fungi_cutter_mode") + fun ItemStack.getRanchersSpeed() = getAttributeInt("ranchers_speed") + fun ItemStack.getRune(): NEUInternalName? { val runesMap = getExtraAttributes()?.getCompoundTag("runes") ?: return null val runesList = runesMap.keySet.associateWith { runesMap.getInteger(it) }.toList() -- cgit