blob: eedf664a30cf5d8dd59ca73e680cded94d27fa11 (
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
|
package at.hannibal2.skyhanni.dungeon
import at.hannibal2.skyhanni.events.DungeonEnterEvent
import at.hannibal2.skyhanni.misc.ScoreboardData
import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
class DungeonData {
companion object {
var dungeonFloor: String? = null
fun isOneOf(vararg floors: String): Boolean {
for (floor in floors) {
if (dungeonFloor == floor) {
return true
}
}
return false
}
}
@SubscribeEvent
fun onTick(event: TickEvent.ClientTickEvent) {
if (event.phase != TickEvent.Phase.START) return
if (LorenzUtils.inDungeons) {
if (dungeonFloor == null) {
for (line in ScoreboardData.sidebarLines) {
if (line.contains("The Catacombs (")) {
dungeonFloor = line.substringAfter("(").substringBefore(")")
DungeonEnterEvent(dungeonFloor!!).postAndCatch()
break
}
}
}
}
}
@SubscribeEvent
fun onWorldChange(event: WorldEvent.Load) {
dungeonFloor = null
}
}
|