From 1fed1e52b4923bee2552a4a7b407010891700871 Mon Sep 17 00:00:00 2001 From: nea Date: Sun, 27 Aug 2023 17:30:14 +0200 Subject: Fix cursor position being saved when disabled --- .../moe/nea/firmament/features/inventory/SaveCursorPosition.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main/kotlin/moe/nea/firmament') diff --git a/src/main/kotlin/moe/nea/firmament/features/inventory/SaveCursorPosition.kt b/src/main/kotlin/moe/nea/firmament/features/inventory/SaveCursorPosition.kt index 3030d6a..2748822 100644 --- a/src/main/kotlin/moe/nea/firmament/features/inventory/SaveCursorPosition.kt +++ b/src/main/kotlin/moe/nea/firmament/features/inventory/SaveCursorPosition.kt @@ -8,7 +8,6 @@ package moe.nea.firmament.features.inventory import kotlin.math.absoluteValue import kotlin.time.Duration.Companion.milliseconds -import kotlin.time.Duration.Companion.seconds import net.minecraft.client.util.InputUtil import moe.nea.firmament.features.FirmamentFeature import moe.nea.firmament.gui.config.ManagedConfig @@ -48,7 +47,8 @@ object SaveCursorPosition : FirmamentFeature { @JvmStatic fun loadCursor(middleX: Double, middleY: Double): Pair? { - val lastPosition = savedPosition?.takeIf { it.savedAt.passedTime() < 1.seconds } + if (!TConfig.enable) return null + val lastPosition = savedPosition?.takeIf { it.savedAt.passedTime() < TConfig.tolerance } savedPosition = null if (lastPosition != null && (lastPosition.middle.first - middleX).absoluteValue < 1 && @@ -67,6 +67,7 @@ object SaveCursorPosition : FirmamentFeature { @JvmStatic fun saveCursorMiddle(middleX: Double, middleY: Double) { + if (!TConfig.enable) return val cursorPos = assertNotNullOr(savedPositionedP1) { return } savedPosition = SavedPosition(Pair(middleX, middleY), cursorPos) } -- cgit