diff options
author | Empa <42304516+ItsEmpa@users.noreply.github.com> | 2024-07-06 10:51:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-06 10:51:25 +0200 |
commit | 63c89c9f4b00228362473180ddf91461a340ca1f (patch) | |
tree | dfe5b39f43046bdfbb43163d721165976317a050 /src/main/java/at | |
parent | 4314c0c6fe9fdf46c4aeddfae2c212b2bcfe3a49 (diff) | |
download | skyhanni-63c89c9f4b00228362473180ddf91461a340ca1f.tar.gz skyhanni-63c89c9f4b00228362473180ddf91461a340ca1f.tar.bz2 skyhanni-63c89c9f4b00228362473180ddf91461a340ca1f.zip |
Improvement: Estimated Item Value support in Custom Wardrobe (#2080)
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt | 15 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt | 6 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt index 08abfa34d..d12e61d35 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt @@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.events.InventoryUpdatedEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.features.inventory.wardrobe.WardrobeAPI.MAX_PAGES import at.hannibal2.skyhanni.features.inventory.wardrobe.WardrobeAPI.MAX_SLOT_PER_PAGE +import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValue import at.hannibal2.skyhanni.mixins.transformers.gui.AccessorGuiContainer import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.test.command.ErrorManager @@ -41,7 +42,6 @@ import java.awt.Color import kotlin.math.min import kotlin.time.Duration.Companion.milliseconds -// TODO add support for estimated item value @SkyHanniModule object CustomWardrobe { @@ -89,9 +89,16 @@ object CustomWardrobe { loadingPos.renderRenderable(loadingRenderable, posLabel = guiName, addToGuiManager = false) } + GlStateManager.pushMatrix() GlStateManager.translate(0f, 0f, 100f) + pos.renderRenderable(renderable, posLabel = guiName, addToGuiManager = false) - GlStateManager.translate(0f, 0f, -100f) + + if (EstimatedItemValue.config.enabled) { + GlStateManager.translate(0f, 0f, 400f) + EstimatedItemValue.tryRendering() + } + GlStateManager.popMatrix() event.cancel() } @@ -210,9 +217,13 @@ object CustomWardrobe { renderable = Renderable.hoverTips( renderable, tips = toolTip, + stack = stack, condition = { !config.showTooltipOnlyKeybind || config.tooltipKeybind.isKeyHeld() }, + onHover = { + if (EstimatedItemValue.config.enabled) EstimatedItemValue.updateItem(stack) + }, ) } } 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 dee0a6749..711b126a5 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 @@ -39,7 +39,7 @@ import kotlin.math.roundToLong @SkyHanniModule object EstimatedItemValue { - private val config get() = SkyHanniMod.feature.inventory.estimatedItemValues + val config get() = SkyHanniMod.feature.inventory.estimatedItemValues private var display = emptyList<List<Any>>() private val cache = mutableMapOf<ItemStack, List<List<Any>>>() private var lastToolTipTime = 0L @@ -86,7 +86,7 @@ object EstimatedItemValue { renderedItems = 0 } - private fun tryRendering() { + fun tryRendering() { currentlyShowing = checkCurrentlyVisible() if (!currentlyShowing) return @@ -129,7 +129,7 @@ object EstimatedItemValue { updateItem(event.stack) } - private fun updateItem(item: ItemStack) { + fun updateItem(item: ItemStack) { cache[item]?.let { display = it lastToolTipTime = System.currentTimeMillis() |