aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-05-12 00:53:09 +0200
committerGitHub <noreply@github.com>2024-05-12 00:53:09 +0200
commit3bb4b9b9826fadd8df3507ea86b6196b6487b981 (patch)
tree9876124908f9d0a9656b1ab9690a3c2211bc9435 /src/main/java/at/hannibal2/skyhanni/features
parentb391c5d5c660436112da31d69e025bd6f4622a02 (diff)
downloadskyhanni-3bb4b9b9826fadd8df3507ea86b6196b6487b981.tar.gz
skyhanni-3bb4b9b9826fadd8df3507ea86b6196b6487b981.tar.bz2
skyhanni-3bb4b9b9826fadd8df3507ea86b6196b6487b981.zip
Feature: Blaze Slayer Fire Pillar Display (#1766)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/FirePillarDisplay.kt51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/FirePillarDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/FirePillarDisplay.kt
new file mode 100644
index 000000000..4ffba9378
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/FirePillarDisplay.kt
@@ -0,0 +1,51 @@
+package at.hannibal2.skyhanni.features.slayer.blaze
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.IslandType
+import at.hannibal2.skyhanni.events.GuiRenderEvent
+import at.hannibal2.skyhanni.events.LorenzTickEvent
+import at.hannibal2.skyhanni.utils.EntityUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
+import at.hannibal2.skyhanni.utils.RenderUtils.renderString
+import at.hannibal2.skyhanni.utils.StringUtils.matchFirst
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
+import net.minecraft.entity.item.EntityArmorStand
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class FirePillarDisplay {
+ private val config get() = SkyHanniMod.feature.slayer.blazes
+
+ /**
+ * REGEX-TEST: §6§l2s §c§l8 hits
+ */
+ private val entityNamePattern by RepoPattern.pattern(
+ "slayer.blaze.firepillar.entityname",
+ "§6§l(?<seconds>.*)s §c§l8 hits"
+ )
+
+ private var display = ""
+
+ @SubscribeEvent
+ fun onTick(event: LorenzTickEvent) {
+ if (!isEnabled()) return
+
+ val seconds = EntityUtils.getEntities<EntityArmorStand>()
+ .map { it.name }
+ .matchFirst<String?>(entityNamePattern) {
+ group("seconds")
+ }
+
+ display = seconds?.let {
+ "§cFire Pillar: §b${seconds}s"
+ } ?: ""
+ }
+
+ @SubscribeEvent
+ fun onRenderOverlay(event: GuiRenderEvent) {
+ if (!isEnabled()) return
+
+ config.firePillarDisplayPosition.renderString(display, posLabel = "Fire Pillar")
+ }
+
+ fun isEnabled() = IslandType.CRIMSON_ISLE.isInIsland() && config.firePillarDisplay
+}