diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-12-29 21:47:46 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-12-29 21:47:46 +0100 |
commit | f175e24a431d67bae406ffcd45e88c82f93ec8fd (patch) | |
tree | 4a05e9731e1d7612135a4c9584d5ffa6e0da0c02 /src | |
parent | b7d95a344ddf32ba004797aab5500555555d7834 (diff) | |
download | skyhanni-f175e24a431d67bae406ffcd45e88c82f93ec8fd.tar.gz skyhanni-f175e24a431d67bae406ffcd45e88c82f93ec8fd.tar.bz2 skyhanni-f175e24a431d67bae406ffcd45e88c82f93ec8fd.zip |
Adding wishing compass uses amount display.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java | 15 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt | 17 |
2 files changed, 25 insertions, 7 deletions
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 290492705..175dcb42d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java @@ -89,13 +89,14 @@ public class Inventory { ) @ConfigEditorDraggableList( exampleText = { - "\u00a7bMaster Star Tier", - "\u00a7bMaster Skull Tier", - "\u00a7bDungeon Head Floor Number", - "\u00a7bNew Year Cake", - "\u00a7bPet Level", - "\u00a7bMinion Tier", - "\u00a7bCrimson Armor", + "§bMaster Star Tier", + "§bMaster Skull Tier", + "§bDungeon Head Floor Number", + "§bNew Year Cake", + "§bPet Level", + "§bMinion Tier", + "§bCrimson Armor", + "§bWishing Compass" } ) public List<Integer> itemNumberAsStackSize = new ArrayList<>(Collections.singletonList(3)); 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 bc1d310cc..4e25e3c83 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -10,9 +10,12 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.util.regex.Pattern class ItemDisplayOverlayFeatures { + private val wishingCompassPattern = Pattern.compile("§7Remaining Uses: §e(.*)§8/§e3") + @SubscribeEvent fun onRenderItemTip(event: RenderItemTipEvent) { event.stackTip = getStackTip(event.stack) @@ -83,6 +86,20 @@ class ItemDisplayOverlayFeatures { } } + if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(7)) { + if (name.contains("Wishing Compass")) { + for (line in item.getLore()) { + val matcher = wishingCompassPattern.matcher(line) + if (matcher.matches()) { + val uses = matcher.group(1) + if (uses != "3") { + return uses + } + } + } + } + } + return "" } |