aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-08-27 17:30:14 +0200
committernea <nea@nea.moe>2023-08-27 17:33:06 +0200
commit1fed1e52b4923bee2552a4a7b407010891700871 (patch)
tree8f238d53b28feb8efe9859ec91def659fcaba2cb
parent519fcf26a30ac3a3fcc1adc0c21e84f6f0ec4a2a (diff)
downloadfirmament-1fed1e52b4923bee2552a4a7b407010891700871.tar.gz
firmament-1fed1e52b4923bee2552a4a7b407010891700871.tar.bz2
firmament-1fed1e52b4923bee2552a4a7b407010891700871.zip
Fix cursor position being saved when disabled
-rw-r--r--src/main/kotlin/moe/nea/firmament/features/inventory/SaveCursorPosition.kt5
1 files changed, 3 insertions, 2 deletions
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<Double, Double>? {
- 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)
}