From 5c7fd8edf57f02576245288c93910e95952e9835 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 28 Jul 2024 11:28:12 +0200 Subject: fixed skyhanni trackers not being modifiable inside other menus --- .../at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt index 1bfe6ac6f..345767b05 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt @@ -15,6 +15,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.renderables.Renderable import net.minecraft.client.Minecraft +import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.client.gui.inventory.GuiInventory import kotlin.time.Duration.Companion.seconds @@ -49,7 +50,7 @@ open class SkyHanniTracker( reset(DisplayMode.TOTAL, "Reset total $name!") }, "§eClick to confirm.", - oneTimeClick = true + oneTimeClick = true, ) fun modify(modifyFunction: (Data) -> Unit) { @@ -72,7 +73,7 @@ open class SkyHanniTracker( fun renderDisplay(position: Position) { if (config.hideInEstimatedItemValue && EstimatedItemValue.isCurrentlyShowing()) return - val currentlyOpen = Minecraft.getMinecraft().currentScreen is GuiInventory + val currentlyOpen = Minecraft.getMinecraft().currentScreen?.let { it is GuiInventory || it is GuiChest } ?: false if (!currentlyOpen && config.hideItemTrackersOutsideInventory && this is SkyHanniItemTracker) { return } @@ -110,14 +111,15 @@ open class SkyHanniTracker( listOf( "§cThis will reset your", "§ccurrent session of", - "§c$name" + "§c$name", ), onClick = { if (sessionResetTime.passedSince() > 3.seconds) { reset(DisplayMode.SESSION, "Reset this session of $name!") sessionResetTime = SimpleTimeMark.now() } - }) + }, + ) private fun buildDisplayModeView() = LorenzUtils.buildSelector( "§7Display Mode: ", @@ -127,7 +129,7 @@ open class SkyHanniTracker( displayMode = it storedTrackers[name] = it update() - } + }, ) protected fun getSharedTracker() = ProfileStorageData.profileSpecific?.let { -- cgit