From 8dd26f8883de2cc5997d891f7067360ff7ac5db8 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 5 Nov 2023 13:13:36 +0100 Subject: Added a workaround for NEU Profile Viewer bug where the ItemTooltipEvent gets called for two items when hovering over the border between two items. --- .../skyhanni/features/misc/items/EstimatedItemValue.kt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/main/java') 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 05b61aa65..c5b87eb20 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 @@ -59,10 +59,23 @@ object EstimatedItemValue { if (Minecraft.getMinecraft().currentScreen is GuiProfileViewer) { updateItem(event.itemStack) - tryRendering() + if (!blockNextFrame && renderedItems < 2) { + tryRendering() + } + renderedItems++ } } + // Workaround for NEU Profile Viewer bug where the ItemTooltipEvent gets called for two items when hovering over the border between two items. + private var renderedItems = 0 + private var blockNextFrame = false + + @SubscribeEvent + fun onRenderOverlayGui(event: GuiRenderEvent.GuiOverlayRenderEvent) { + blockNextFrame = renderedItems > 1 + renderedItems = 0 + } + private fun tryRendering() { currentlyShowing = checkCurrentlyVisible() if (!currentlyShowing) return -- cgit