From 3bb4b9b9826fadd8df3507ea86b6196b6487b981 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Sun, 12 May 2024 00:53:09 +0200 Subject: Feature: Blaze Slayer Fire Pillar Display (#1766) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../features/slayer/blaze/FirePillarDisplay.kt | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/FirePillarDisplay.kt (limited to 'src/main/java/at/hannibal2/skyhanni/features') 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(?.*)s §c§l8 hits" + ) + + private var display = "" + + @SubscribeEvent + fun onTick(event: LorenzTickEvent) { + if (!isEnabled()) return + + val seconds = EntityUtils.getEntities() + .map { it.name } + .matchFirst(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 +} -- cgit