diff options
| author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-06-08 23:46:53 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-08 23:46:53 +1000 |
| commit | a2f29b2bfe846c9d0cd2a45b2b8352bab556da37 (patch) | |
| tree | 53f830999399a1d005e16a53beec041337629285 /src/main/java/at/hannibal2/skyhanni/features/event | |
| parent | f5aa000de598fd4f367ca37cb8f2e1935f64b634 (diff) | |
| download | skyhanni-a2f29b2bfe846c9d0cd2a45b2b8352bab556da37.tar.gz skyhanni-a2f29b2bfe846c9d0cd2a45b2b8352bab556da37.tar.bz2 skyhanni-a2f29b2bfe846c9d0cd2a45b2b8352bab556da37.zip | |
Even more annotation (#2031)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/event')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt | 59 |
1 files changed, 29 insertions, 30 deletions
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<String>? = 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<String>? = 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( |
