From bf0a964361373944f5d50b7a824b23d6507941b4 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Thu, 18 Apr 2024 00:25:16 +1000 Subject: Fix: Stop rendering an empty string on every item (#1465) --- src/main/java/at/hannibal2/skyhanni/events/RenderItemTipEvent.kt | 1 + .../skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/events/RenderItemTipEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RenderItemTipEvent.kt index d9341cc87..5a144cb7e 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/RenderItemTipEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/RenderItemTipEvent.kt @@ -9,6 +9,7 @@ class RenderItemTipEvent( var stackTip = "" set(value) { + if (value.isEmpty()) return renderObjects.add(RenderObject(value, 0, 0)) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt index bebac7d45..23aadf86b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -82,10 +82,10 @@ object ItemDisplayOverlayFeatures { @SubscribeEvent fun onRenderItemTip(event: RenderItemTipEvent) { - event.stackTip = getStackTip(event.stack) + event.stackTip = getStackTip(event.stack) ?: return } - private fun getStackTip(item: ItemStack): String { + private fun getStackTip(item: ItemStack): String? { val itemName = item.cleanName() val internalName = item.getInternalName() val chestName = InventoryUtils.openInventoryName() @@ -258,7 +258,7 @@ object ItemDisplayOverlayFeatures { } } - return "" + return null } private fun isOwnVacuum(lore: List) = -- cgit