aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/combat
diff options
context:
space:
mode:
authorXupie <81492239+Xupie@users.noreply.github.com>2024-07-06 11:40:56 +0300
committerGitHub <noreply@github.com>2024-07-06 10:40:56 +0200
commit4314c0c6fe9fdf46c4aeddfae2c212b2bcfe3a49 (patch)
treeb27f35f677b45cd09a9770e8e5fa163f07fb1423 /src/main/java/at/hannibal2/skyhanni/features/combat
parente6b2bcbcdb17f729ead84fd2a2d5d8c0dc6eebc3 (diff)
downloadskyhanni-4314c0c6fe9fdf46c4aeddfae2c212b2bcfe3a49.tar.gz
skyhanni-4314c0c6fe9fdf46c4aeddfae2c212b2bcfe3a49.tar.bz2
skyhanni-4314c0c6fe9fdf46c4aeddfae2c212b2bcfe3a49.zip
Feature: Armor Stack Display (#1811)
Co-authored-by: Xupie <> Co-authored-by: Cal <cwolfson58@gmail.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/combat')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/ArmorStackDisplay.kt43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ArmorStackDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ArmorStackDisplay.kt
new file mode 100644
index 000000000..942adc20b
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ArmorStackDisplay.kt
@@ -0,0 +1,43 @@
+package at.hannibal2.skyhanni.features.combat
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.ActionBarUpdateEvent
+import at.hannibal2.skyhanni.events.GuiRenderEvent
+import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.RegexUtils.findMatcher
+import at.hannibal2.skyhanni.utils.RenderUtils.renderString
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+@SkyHanniModule
+object ArmorStackDisplay {
+ private val config get() = SkyHanniMod.feature.combat.stackDisplayConfig
+ private var display = ""
+
+ /**
+ * REGEX-TEST: §66,171/4,422❤ §6§l10ᝐ§r §a1,295§a❈ Defense §b525/1,355✎ §3400ʬ
+ * REGEX-TEST: §66,171/4,422❤ §65ᝐ §b-150 Mana (§6Wither Impact§b) §b1,016/1,355✎ §3400ʬ
+ */
+ private val armorStackPattern by RepoPattern.pattern(
+ "combat.armorstack.actionbar",
+ " (?:§6|§6§l)(?<stack>\\d+[ᝐ⁑|҉Ѫ⚶])"
+ )
+
+ @SubscribeEvent
+ fun onActionBar(event: ActionBarUpdateEvent) {
+ if (!isEnabled()) return
+ val stacks = armorStackPattern.findMatcher(event.actionBar) {
+ "§6§l" + group("stack")
+ } ?: ""
+ display = stacks
+ }
+
+ @SubscribeEvent
+ fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {
+ if (!isEnabled()) return
+ config.position.renderString(display, posLabel = "Armor Stack Display")
+ }
+
+ fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled
+}