From 795e30bcecb1f72a9eb32331867d20f29554505a Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Fri, 23 Aug 2024 10:50:42 +0200 Subject: Fix: Patcher Breaking Lines (#2387) Co-authored-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/features/misc/PatcherFixes.kt | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/PatcherFixes.kt (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherFixes.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherFixes.kt new file mode 100644 index 000000000..a7d844e4e --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherFixes.kt @@ -0,0 +1,47 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.OtherModsSettings +import at.hannibal2.skyhanni.utils.SimpleTimeMark +import kotlin.time.Duration.Companion.minutes +import kotlin.time.Duration.Companion.seconds + +object PatcherFixes { + private val config get() = SkyHanniMod.feature.misc + + private var lastCheck = SimpleTimeMark.farPast() + private var lastChatMessage = SimpleTimeMark.farPast() + + fun onPlayerEyeLine() { + if (!isEnabled()) return + if (lastCheck.passedSince() < 5.seconds) return + lastCheck = SimpleTimeMark.now() + + val patcher = OtherModsSettings.patcher() + if (!patcher.getBoolean("parallaxFix")) return + + if (lastChatMessage.passedSince() < 3.minutes) return + lastChatMessage = SimpleTimeMark.now() + + ChatUtils.clickToActionOrDisable( + "§cPatcher's Parallax Fix breaks SkyHanni's line rendering!", + config::fixPatcherLines, + "disable this option in Patcher", + action = { tryFix() }, + ) + } + + private fun tryFix() { + val patcher = OtherModsSettings.patcher() + if (patcher.getBoolean("parallaxFix")) { + patcher.setBoolean("parallaxFix", false) + ChatUtils.chat("§aDisabled Patcher's Parallax Fix! SkyHanni's lines should now work correctly.") + } else { + ChatUtils.userError("Patcher's Parallax is already disabled!") + } + } + + private fun isEnabled() = LorenzUtils.inSkyBlock && config.fixPatcherLines +} -- cgit