From 3f25c2c3dbd31adfe9a2b1b5dd2a996b05528d19 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 25 Nov 2023 13:46:12 +0100 Subject: Fixed EstimatedItemValue.isCurrentlyShowing logic --- src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt | 2 +- .../at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt | 4 +++- src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt index 0f472aafa..f8817b43b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt @@ -45,7 +45,7 @@ class ChestValue { if (InventoryUtils.openInventoryName() == "") return if (!config.showDuringEstimatedItemValue) { - if (EstimatedItemValue.currentlyShowing) return + if (EstimatedItemValue.isCurrentlyShowing()) return } if (inInventory) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt index 87394161f..bfdd876c3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt @@ -38,7 +38,9 @@ object EstimatedItemValue { private val cache = mutableMapOf>>() private var lastToolTipTime = 0L var gemstoneUnlockCosts = HashMap>>() - var currentlyShowing = false + private var currentlyShowing = false + + fun isCurrentlyShowing() = currentlyShowing && Minecraft.getMinecraft().currentScreen != null @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { 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 331be034b..bc2db88e1 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt @@ -65,7 +65,7 @@ open class SkyHanniTracker( } fun renderDisplay(position: Position) { - if (config.hideInEstimatedItemValue && EstimatedItemValue.currentlyShowing) return + if (config.hideInEstimatedItemValue && EstimatedItemValue.isCurrentlyShowing()) return val currentlyOpen = Minecraft.getMinecraft().currentScreen is GuiInventory if (inventoryOpen != currentlyOpen) { -- cgit