aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/InventoryCloseEvent.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt2
3 files changed, 9 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt
index 5950d5fb8..921d591b2 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt
@@ -22,9 +22,9 @@ object OtherInventoryData {
close()
}
- fun close() {
+ fun close(reopenSameName: Boolean = false) {
currentInventory?.let {
- InventoryCloseEvent(it).postAndCatch()
+ InventoryCloseEvent(it, reopenSameName).postAndCatch()
currentInventory = null
}
}
@@ -49,7 +49,8 @@ object OtherInventoryData {
val windowId = packet.windowId
val title = packet.windowTitle.unformattedText
val slotCount = packet.slotCount
- close()
+ val reopenSameName = title == currentInventory?.title
+ close(reopenSameName)
currentInventory = Inventory(windowId, title, slotCount)
acceptItems = true
@@ -104,4 +105,4 @@ object OtherInventoryData {
val slotCount: Int,
val items: MutableMap<Int, ItemStack> = mutableMapOf(),
)
-} \ No newline at end of file
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/events/InventoryCloseEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/InventoryCloseEvent.kt
index bf43a57f9..72630756a 100644
--- a/src/main/java/at/hannibal2/skyhanni/events/InventoryCloseEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/events/InventoryCloseEvent.kt
@@ -3,9 +3,9 @@ package at.hannibal2.skyhanni.events
import at.hannibal2.skyhanni.data.OtherInventoryData
import net.minecraft.item.ItemStack
-class InventoryCloseEvent(val inventory: OtherInventoryData.Inventory) : LorenzEvent() {
+class InventoryCloseEvent(val inventory: OtherInventoryData.Inventory, val reopenSameName: Boolean) : LorenzEvent() {
val inventoryId: Int by lazy { inventory.windowId }
val inventoryName: String by lazy { inventory.title }
val inventorySize: Int by lazy { inventory.slotCount }
val inventoryItems: Map<Int, ItemStack> by lazy { inventory.items }
-} \ No newline at end of file
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
index 5840475ce..1e19ca676 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
@@ -175,6 +175,8 @@ class MinionFeatures {
@SubscribeEvent
fun onInventoryClose(event: InventoryCloseEvent) {
+ if (event.reopenSameName) return
+
minionStorageInventoryOpen = false
if (!minionInventoryOpen) return
val minions = minions ?: return