blob: 441dac11bbea6576a552d0a6e4d3f5e31910898a (
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
|
package at.hannibal2.skyhanni.features.nether
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.data.model.TabWidget
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.WidgetUpdateEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@SkyHanniModule
object VolcanoExplosivityDisplay {
private val config get() = SkyHanniMod.feature.crimsonIsle
private val patternGroup = RepoPattern.group("crimson.volcano")
/**
* REGEX-TEST: Volcano: §r§8INACTIVE
*/
private val statusPattern by patternGroup.pattern(
"tablistline",
" *Volcano: (?<status>(?:§.)*\\S+)",
)
private var display = ""
@SubscribeEvent
fun onTabListUpdate(event: WidgetUpdateEvent) {
if (!isEnabled()) return
if (!event.isWidget(TabWidget.VOLCANO)) return
if (event.isClear()) {
display = ""
return
}
// TODO merge widget pattern with statusPattern
statusPattern.matchMatcher(event.lines.first()) {
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
}
|