From 6b253a8ac2cdb03a67f111725c263dd84532f989 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 06:02:52 +0100 Subject: Fixed crash. --- .../hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt index a72466a66..afdc446f9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -13,6 +13,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.StringUtils.removeColor import com.google.gson.JsonObject +import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.inventory.ContainerChest import net.minecraft.item.ItemStack @@ -92,7 +93,10 @@ class HideNotClickableItems { fun onTooltip(event: ItemTooltipEvent) { if (isDisabled()) return if (event.toolTip == null) return - val chestName = InventoryUtils.openInventoryName() + + val guiChest = Minecraft.getMinecraft().currentScreen + if (guiChest !is GuiChest) return + val chestName = (guiChest.inventorySlots as ContainerChest).getInventoryName() val stack = event.itemStack if (InventoryUtils.getItemsInOpenChest().map { it.stack }.contains(stack)) return -- cgit