Skip to content

Commit

Permalink
Merged main
Browse files Browse the repository at this point in the history
  • Loading branch information
odtheking committed Oct 28, 2024
1 parent 5f55938 commit 6e8e326
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,13 @@ object BeamsSolver {

private var currentLanternPairs = ConcurrentHashMap<BlockPos, Pair<BlockPos, Color>>()

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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ object TPMazeSolver {
private var correctPortals = listOf<BlockPos>()
private var visited = CopyOnWriteArraySet<BlockPos>()

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()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ object WaterSolver {
private var solutions = ConcurrentHashMap<LeverBlock, Array<Double>>()
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) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6e8e326

Please sign in to comment.