diff --git a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/BeamsSolver.kt b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/BeamsSolver.kt index 1233aab09..2a2c5755c 100644 --- a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/BeamsSolver.kt +++ b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/BeamsSolver.kt @@ -39,14 +39,13 @@ object BeamsSolver { private var currentLanternPairs = ConcurrentHashMap>() - fun onRoomEnter(event: RoomEnterEvent) { - val room = event.room ?: return - if (room.data.name != "Creeper Beams") return reset() + fun onRoomEnter(event: RoomEnterEvent) = with(event.room) { + if (this?.data?.name != "Creeper Beams") return reset() currentLanternPairs.clear() lanternPairs.forEach { - val pos = room.getRealCoords(it[0], it[1], it[2]) - val pos2 = room.getRealCoords(it[3], it[4], it[5]) + val pos = getRealCoords(it[0], it[1], it[2]) + val pos2 = getRealCoords(it[3], it[4], it[5]) if (getBlockIdAt(pos) == 169 && getBlockIdAt(pos2) == 169) currentLanternPairs[pos] = pos2 to colors[currentLanternPairs.size] diff --git a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/IceFillSolver.kt b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/IceFillSolver.kt index 5e9ad4eb2..749bda946 100644 --- a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/IceFillSolver.kt +++ b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/IceFillSolver.kt @@ -42,11 +42,10 @@ object IceFillSolver { Renderer.draw3DLine(currentPatterns, color = color, depth = true) } - fun onRoomEnter(event: RoomEnterEvent) { - val room = event.room ?: return - if (room.data.name != "Ice Fill" || currentPatterns.isNotEmpty()) return + fun onRoomEnter(event: RoomEnterEvent) = with (event.room) { + if (this?.data?.name != "Ice Fill" || currentPatterns.isNotEmpty()) return - scanAllFloors(room.getRealCoords(15, 70, 7).toVec3(), room.rotation) + scanAllFloors(getRealCoords(15, 70, 7).toVec3(), rotation) } private fun scanAllFloors(pos: Vec3, rotation: Rotations) { diff --git a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/QuizSolver.kt b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/QuizSolver.kt index deb35b1fe..6b096b071 100644 --- a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/QuizSolver.kt +++ b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/QuizSolver.kt @@ -7,7 +7,6 @@ import me.odinmain.events.impl.DungeonEvents.RoomEnterEvent import me.odinmain.features.impl.dungeon.puzzlesolvers.PuzzleSolvers.quizDepth import me.odinmain.utils.* import me.odinmain.utils.render.* -import me.odinmain.utils.skyblock.dungeon.DungeonUtils import me.odinmain.utils.skyblock.dungeon.DungeonUtils.getRealCoords import net.minecraft.util.BlockPos import java.io.InputStreamReader @@ -57,9 +56,9 @@ object QuizSolver { fun onRoomEnter(event: RoomEnterEvent) = with(event.room) { if (this?.data?.name != "Quiz") return - triviaOptions[0].blockPos = this.getRealCoords(BlockPos(20.0, 70.0, 6.0)) - triviaOptions[1].blockPos = this.getRealCoords(BlockPos(15.0, 70.0, 9.0)) - triviaOptions[2].blockPos = this.getRealCoords(BlockPos(10.0, 70.0, 6.0)) + triviaOptions[0].blockPos = getRealCoords(BlockPos(20.0, 70.0, 6.0)) + triviaOptions[1].blockPos = getRealCoords(BlockPos(15.0, 70.0, 9.0)) + triviaOptions[2].blockPos = getRealCoords(BlockPos(10.0, 70.0, 6.0)) } fun onRenderWorld() { diff --git a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/TPMazeSolver.kt b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/TPMazeSolver.kt index 0e4d31968..36ddf3042 100644 --- a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/TPMazeSolver.kt +++ b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/TPMazeSolver.kt @@ -22,11 +22,10 @@ object TPMazeSolver { private var correctPortals = listOf() private var visited = CopyOnWriteArraySet() - fun onRoomEnter(event: DungeonEvents.RoomEnterEvent) { - val room = event.room ?: return - if (room.data.name != "Teleport Maze") return + fun onRoomEnter(event: DungeonEvents.RoomEnterEvent) = with(event.room) { + if (this?.data?.name != "Teleport Maze") return - tpPads = BlockPos.getAllInBox(room.getRealCoords(BlockPos(0, 69, 0)), room.getRealCoords(BlockPos(30, 69, 30))) + tpPads = BlockPos.getAllInBox(getRealCoords(BlockPos(0, 69, 0)), getRealCoords(BlockPos(30, 69, 30))) .filter { getBlockAt(it) == Blocks.end_portal_frame }.toSet() } diff --git a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/WaterSolver.kt b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/WaterSolver.kt index 9aac534f2..8502ccd33 100644 --- a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/WaterSolver.kt +++ b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/WaterSolver.kt @@ -38,10 +38,9 @@ object WaterSolver { private var solutions = ConcurrentHashMap>() private var openedWater = -1L - fun scan() { - val room = DungeonUtils.currentRoom ?: return - if (room.data.name != "Water Board" || variant != -1) return - solve(room) + fun scan() = with (DungeonUtils.currentRoom) { + if (this?.data?.name != "Water Board" || variant != -1) return + solve(this) } private fun solve(room: Room) { @@ -97,12 +96,12 @@ object WaterSolver { times.drop(lever.i).filter { it != 0.0 } }.sorted() - val first = solutionList.firstOrNull() ?: return + val firstSolution = solutionList.firstOrNull() ?: return - if (PuzzleSolvers.showTracer) Renderer.draw3DLine(listOf(mc.thePlayer.renderVec, first.first.leverPos.addVector(.5, .5, .5)), color = PuzzleSolvers.tracerColorFirst, depth = true) + if (PuzzleSolvers.showTracer) Renderer.draw3DLine(listOf(mc.thePlayer.renderVec, firstSolution.first.leverPos.addVector(.5, .5, .5)), color = PuzzleSolvers.tracerColorFirst, depth = true) if (solutionList.size > 1 && PuzzleSolvers.showTracer) { - if (first.first.leverPos != solutionList[1].first.leverPos) { + if (firstSolution.first.leverPos != solutionList[1].first.leverPos) { Renderer.draw3DLine( listOf(solutionList.first().first.leverPos.addVector(0.5, 0.5, 0.5), solutionList[1].first.leverPos.addVector(0.5, 0.5, 0.5)), color = PuzzleSolvers.tracerColorSecond, lineWidth = 1.5f, depth = true