From 3ca14b784cd41cf4fac5584b723edfa45fbd50d8 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 4 Mar 2023 15:39:39 +0100 Subject: Reactivated dungeon features --- .../at/hannibal2/skyhanni/features/dungeon/DungeonData.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/main') diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonData.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonData.kt index b14bf4b4a..9b5430b93 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonData.kt @@ -9,9 +9,12 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent +import java.util.regex.Pattern class DungeonData { + private val pattern = Pattern.compile(" §7⏣ §cThe Catacombs §7\\((.*)\\)") + companion object { var dungeonFloor: String? = null var inBossRoom = false @@ -63,13 +66,12 @@ class DungeonData { fun onTick(event: TickEvent.ClientTickEvent) { if (event.phase != TickEvent.Phase.START) return if (dungeonFloor == null) { - for (line in ScoreboardData.sidebarLines) { - //TODO mixins - if (line.contains("The Catacombs (")) { - val floor = line.substringAfter("(").substringBefore(")") + for (line in ScoreboardData.sidebarLinesFormatted) { + val matcher = pattern.matcher(line) + if (matcher.matches()) { + val floor = matcher.group(1) dungeonFloor = floor DungeonEnterEvent(floor).postAndCatch() - break } } } -- cgit