aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/dungeon/DungeonData.kt
diff options
context:
space:
mode:
authorLorenz <ESs95s3P5z8Pheb>2022-07-14 12:06:07 +0200
committerLorenz <ESs95s3P5z8Pheb>2022-07-14 12:06:07 +0200
commita5c540d977a3510812cac7fac340fe17e7d10983 (patch)
treedbbe5b208e6871378a10868d1206d1d78beeb950 /src/main/java/at/hannibal2/skyhanni/dungeon/DungeonData.kt
parentd6c99ed30a2b1cb228b2fdc3d3178cf1f369dc53 (diff)
downloadskyhanni-a5c540d977a3510812cac7fac340fe17e7d10983.tar.gz
skyhanni-a5c540d977a3510812cac7fac340fe17e7d10983.tar.bz2
skyhanni-a5c540d977a3510812cac7fac340fe17e7d10983.zip
renamed mod to SkyHanni
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/dungeon/DungeonData.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/dungeon/DungeonData.kt46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/dungeon/DungeonData.kt b/src/main/java/at/hannibal2/skyhanni/dungeon/DungeonData.kt
new file mode 100644
index 000000000..eedf664a3
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/dungeon/DungeonData.kt
@@ -0,0 +1,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
+ }
+} \ No newline at end of file