blob: 8f0eb3d34519f9278492a87936b07e5c4f69c2d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
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.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.EntityUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.RegexUtils.matchFirst
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraft.entity.item.EntityArmorStand
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@SkyHanniModule
object 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
}
|