diff options
author | Erymanthus | RayDeeUx <51521765+RayDeeUx@users.noreply.github.com> | 2024-01-21 05:10:32 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-21 11:10:32 +0100 |
commit | cf0bd0fe4304a0d24f5343b2b9f77db22ad53814 (patch) | |
tree | c1ac8d3b2c778f3cf53cf7cf2dd9b452ed90d9e4 /src/main | |
parent | 6379632b07f05c47909c4eae787921adbe330886 (diff) | |
download | skyhanni-cf0bd0fe4304a0d24f5343b2b9f77db22ad53814.tar.gz skyhanni-cf0bd0fe4304a0d24f5343b2b9f77db22ad53814.tar.bz2 skyhanni-cf0bd0fe4304a0d24f5343b2b9f77db22ad53814.zip |
Feature: Volcano Explosivity Display (#937)
Added Volcano Explosivity. #937
Diffstat (limited to 'src/main')
3 files changed, 55 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index f1250cce3..9b64ee1b5 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -279,6 +279,7 @@ import at.hannibal2.skyhanni.features.misc.update.UpdateManager import at.hannibal2.skyhanni.features.misc.visualwords.ModifyVisualWords import at.hannibal2.skyhanni.features.nether.PabloHelper import at.hannibal2.skyhanni.features.nether.QuestItemHelper +import at.hannibal2.skyhanni.features.nether.VolcanoExplosivityDisplay import at.hannibal2.skyhanni.features.nether.ashfang.AshfangBlazes import at.hannibal2.skyhanni.features.nether.ashfang.AshfangBlazingSouls import at.hannibal2.skyhanni.features.nether.ashfang.AshfangFreezeCooldown @@ -692,6 +693,7 @@ class SkyHanniMod { loadModule(DungeonTeammateOutlines()) loadModule(DungeonRankTabListColor()) loadModule(QuestItemHelper()) + loadModule(VolcanoExplosivityDisplay()) loadModule(PlayerChatSymbols()) loadModule(FixNEUHeavyPearls()) loadModule(QuickCraftFeatures()) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/CrimsonIsleConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/CrimsonIsleConfig.java index 7dd530bc4..c6760ed94 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/CrimsonIsleConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/CrimsonIsleConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.crimsonisle; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.core.config.Position; import at.hannibal2.skyhanni.config.features.crimsonisle.ashfang.AshfangConfig; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.Accordion; @@ -31,4 +32,12 @@ public class CrimsonIsleConfig { @ConfigEditorBoolean @FeatureToggle public boolean pabloHelper = false; + + @Expose + @ConfigOption(name = "Volcano Explosivity", desc = "Shows a HUD of the current volcano explosivity level.") + @ConfigEditorBoolean + public boolean volcanoExplosivity = false; + + @Expose + public Position positionVolcano = new Position(20, 20, false, true); } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt new file mode 100644 index 000000000..c58d7a5c3 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt @@ -0,0 +1,44 @@ +package at.hannibal2.skyhanni.features.nether + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.events.TabListUpdateEvent +import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland +import at.hannibal2.skyhanni.utils.LorenzUtils.nextAfter +import at.hannibal2.skyhanni.utils.RenderUtils.renderString +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import at.hannibal2.skyhanni.utils.StringUtils.matches +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class VolcanoExplosivityDisplay { + private val config get() = SkyHanniMod.feature.crimsonIsle + private val patternGroup = RepoPattern.group("crimson.volcano") + private val headerPattern by patternGroup.pattern( + "header.tablistline", + "(?:§.)*Volcano Explosivity:(?:[\\S ]+)*" + ) + private val statusPattern by patternGroup.pattern( + "status.tablistline", + " *(?<status>(?:§.)*\\S+)" + ) + private var display = "" + + @SubscribeEvent + fun onTick(event: TabListUpdateEvent) { + if (!isEnabled()) return + val text = event.tabList.nextAfter({ headerPattern.matches(it) }) ?: return + statusPattern.matchMatcher(text) { + display = "§bVolcano Explosivity§7: ${group("status")}" + } + } + + @SubscribeEvent + fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { + if (!isEnabled()) return + config.positionVolcano.renderString(display, posLabel = "Volcano Explosivity") + } + + private fun isEnabled() = IslandType.CRIMSON_ISLE.isInIsland() && config.volcanoExplosivity +} |