diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
3 files changed, 68 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java index 456c3451f..b01647609 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java @@ -25,6 +25,11 @@ public class CombatConfig { public QuiverConfig quiverConfig = new QuiverConfig(); @Expose + @ConfigOption(name = "Armor Stack Display", desc = "") + @Accordion + public StackDisplayConfig stackDisplayConfig = new StackDisplayConfig(); + + @Expose @ConfigOption(name = "Summonings", desc = "") @Accordion public SummoningsConfig summonings = new SummoningsConfig(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/StackDisplayConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/StackDisplayConfig.java new file mode 100644 index 000000000..a955fec7a --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/StackDisplayConfig.java @@ -0,0 +1,20 @@ +package at.hannibal2.skyhanni.config.features.combat; + +import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.core.config.Position; +import com.google.gson.annotations.Expose; +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; +import io.github.notenoughupdates.moulconfig.annotations.ConfigLink; +import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; + +public class StackDisplayConfig { + @Expose + @ConfigOption(name = "Enable", desc = "Display the number of stacks on armor pieces like Crimson, Terror, Aurora etc.") + @ConfigEditorBoolean + @FeatureToggle + public boolean enabled = false; + + @Expose + @ConfigLink(owner = StackDisplayConfig.class, field = "enabled") + public Position position = new Position(480, -210, 1.9f); +} 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 +} |