-
-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Blaze Slayer Fire Pillar Display (#1766)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
- Loading branch information
1 parent
b391c5d
commit 3bb4b9b
Showing
5 changed files
with
77 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/FirePillarDisplay.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters