diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-07-28 11:28:12 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-07-28 11:28:12 +0200 |
commit | 5c7fd8edf57f02576245288c93910e95952e9835 (patch) | |
tree | 9f8497170fcc40ede8e8d44a61e5a83448a1c4ca | |
parent | 85804cca4174f7c00560ee4a91c2dbdab30db6d1 (diff) | |
download | skyhanni-5c7fd8edf57f02576245288c93910e95952e9835.tar.gz skyhanni-5c7fd8edf57f02576245288c93910e95952e9835.tar.bz2 skyhanni-5c7fd8edf57f02576245288c93910e95952e9835.zip |
fixed skyhanni trackers not being modifiable inside other menus
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt | 12 |
1 files changed, 7 insertions, 5 deletions
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<Data : TrackerData>( 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<Data : TrackerData>( 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<Data : TrackerData>( 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<DisplayMode>( "§7Display Mode: ", @@ -127,7 +129,7 @@ open class SkyHanniTracker<Data : TrackerData>( displayMode = it storedTrackers[name] = it update() - } + }, ) protected fun getSharedTracker() = ProfileStorageData.profileSpecific?.let { |