From a2f29b2bfe846c9d0cd2a45b2b8352bab556da37 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Sat, 8 Jun 2024 23:46:53 +1000 Subject: Even more annotation (#2031) --- .../features/event/diana/BurrowWarpHelper.kt | 59 +++++++++++----------- 1 file changed, 29 insertions(+), 30 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/event') diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt index 11973f2c7..be8d77a6a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.sorted import at.hannibal2.skyhanni.utils.HypixelCommands @@ -18,7 +19,11 @@ import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class BurrowWarpHelper { +@SkyHanniModule +object BurrowWarpHelper { + + private val config get() = SkyHanniMod.feature.event.diana + var currentWarp: WarpPoint? = null private var lastWarpTime = SimpleTimeMark.farPast() private var lastWarp: WarpPoint? = null @@ -90,37 +95,31 @@ class BurrowWarpHelper { event.addData(list) } - companion object { - - private val config get() = SkyHanniMod.feature.event.diana - var currentWarp: WarpPoint? = null - - fun shouldUseWarps(target: LorenzVec, debug: MutableList? = null) { - debug?.add("target: ${target.printWithAccuracy(1)}") - val playerLocation = LocationUtils.playerLocation() - debug?.add("playerLocation: ${playerLocation.printWithAccuracy(1)}") - val warpPoint = getNearestWarpPoint(target) - debug?.add("warpPoint: ${warpPoint.displayName}") - - val playerDistance = playerLocation.distance(target) - debug?.add("playerDistance: ${playerDistance.round(1)}") - val warpDistance = warpPoint.distance(target) - debug?.add("warpDistance: ${warpDistance.round(1)}") - val difference = playerDistance - warpDistance - debug?.add("difference: ${difference.round(1)}") - val setWarpPoint = difference > 10 - debug?.add("setWarpPoint: $setWarpPoint") - currentWarp = if (setWarpPoint) warpPoint else null - } + fun shouldUseWarps(target: LorenzVec, debug: MutableList? = null) { + debug?.add("target: ${target.printWithAccuracy(1)}") + val playerLocation = LocationUtils.playerLocation() + debug?.add("playerLocation: ${playerLocation.printWithAccuracy(1)}") + val warpPoint = getNearestWarpPoint(target) + debug?.add("warpPoint: ${warpPoint.displayName}") + + val playerDistance = playerLocation.distance(target) + debug?.add("playerDistance: ${playerDistance.round(1)}") + val warpDistance = warpPoint.distance(target) + debug?.add("warpDistance: ${warpDistance.round(1)}") + val difference = playerDistance - warpDistance + debug?.add("difference: ${difference.round(1)}") + val setWarpPoint = difference > 10 + debug?.add("setWarpPoint: $setWarpPoint") + currentWarp = if (setWarpPoint) warpPoint else null + } - private fun getNearestWarpPoint(location: LorenzVec) = - WarpPoint.entries.filter { it.unlocked && !it.ignored() }.map { it to it.distance(location) } - .sorted().first().first + private fun getNearestWarpPoint(location: LorenzVec) = + WarpPoint.entries.filter { it.unlocked && !it.ignored() }.map { it to it.distance(location) } + .sorted().first().first - fun resetDisabledWarps() { - WarpPoint.entries.forEach { it.unlocked = true } - ChatUtils.chat("Reset disabled burrow warps.") - } + fun resetDisabledWarps() { + WarpPoint.entries.forEach { it.unlocked = true } + ChatUtils.chat("Reset disabled burrow warps.") } enum class WarpPoint( -- cgit