diff options
author | jani270 <69345714+jani270@users.noreply.github.com> | 2024-05-02 19:27:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-02 19:27:11 +0200 |
commit | 597a248aea35b9d85b4d886434dd673321424007 (patch) | |
tree | 792abfed0550ca242405dba22a501392665aed64 | |
parent | 8b20e883efb8602f9a0472afe17e463a863f66a4 (diff) | |
download | NotEnoughUpdates-597a248aea35b9d85b4d886434dd673321424007.tar.gz NotEnoughUpdates-597a248aea35b9d85b4d886434dd673321424007.tar.bz2 NotEnoughUpdates-597a248aea35b9d85b4d886434dd673321424007.zip |
Fix Quick Forge not showing correctly in Forge Recipes (#1124)
-rw-r--r-- | src/main/kotlin/io/github/moulberry/notenoughupdates/util/HotmInformation.kt | 17 |
1 files 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]) |