diff options
-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() |