From 597a248aea35b9d85b4d886434dd673321424007 Mon Sep 17 00:00:00 2001 From: jani270 <69345714+jani270@users.noreply.github.com> Date: Thu, 2 May 2024 19:27:11 +0200 Subject: Fix Quick Forge not showing correctly in Forge Recipes (#1124) --- .../moulberry/notenoughupdates/util/HotmInformation.kt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/HotmInformation.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/HotmInformation.kt index a2a61064..2d87a571 100644 --- a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/HotmInformation.kt +++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/HotmInformation.kt @@ -40,8 +40,7 @@ class HotmInformation { val gui = event.gui if (gui !is GuiChest) return - val containerName = (gui.inventorySlots as ContainerChest).lowerChestInventory.displayName.unformattedText - if (containerName == "Heart of the Mountain") { + if (Utils.getOpenChestName() == "Heart of the Mountain") { ticksTillReload = 5 } } @@ -58,12 +57,16 @@ class HotmInformation { private fun loadDataFromInventory() { val profileSpecific = NotEnoughUpdates.INSTANCE.config.profileSpecific ?: return - - for (slot in Minecraft.getMinecraft().thePlayer.openContainer.inventorySlots) { - val stack = slot.stack ?: continue - val displayName = stack.displayName + val currentScreen = Minecraft.getMinecraft().currentScreen + if (currentScreen !is GuiChest) { + return + } + val container = currentScreen.inventorySlots as ContainerChest + for (i in 0 until container.lowerChestInventory.sizeInventory) { + val stack = container.lowerChestInventory.getStackInSlot(i) ?: continue + val displayName = ItemUtils.getDisplayName(stack) ?: continue val lore = ItemUtils.getLore(stack) - if (!lore.any { it.contains("Right click to") }) continue + if (!lore.any { it.contains("Right-click to") }) continue val perkName = StringUtils.cleanColour(displayName) profileSpecific.hotmTree[perkName] = getLevel(lore[0]) -- cgit