diff options
author | Lorenz <ESs95s3P5z8Pheb> | 2022-07-14 12:06:07 +0200 |
---|---|---|
committer | Lorenz <ESs95s3P5z8Pheb> | 2022-07-14 12:06:07 +0200 |
commit | a5c540d977a3510812cac7fac340fe17e7d10983 (patch) | |
tree | dbbe5b208e6871378a10868d1206d1d78beeb950 /src/main/java/at/hannibal2/skyhanni/dungeon/DungeonData.kt | |
parent | d6c99ed30a2b1cb228b2fdc3d3178cf1f369dc53 (diff) | |
download | skyhanni-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.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 |