diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/dungeon/DungeonData.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/dungeon/DungeonData.kt | 46 |
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 |