From 644291019d9033eba9358791b4f771258d4f1163 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 4 Jun 2023 23:23:07 +0200 Subject: Properly sending inventory close event when closing the gui position editor --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 +- .../at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt | 2 ++ src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 4386d81b5..05b2d0cdb 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -121,7 +121,7 @@ class SkyHanniMod { loadModule(ItemTipHelper()) loadModule(RenderLivingEntityHelper()) loadModule(SkillExperience()) - loadModule(OtherInventoryData()) + loadModule(OtherInventoryData) loadModule(TabListData()) loadModule(RenderGuiData()) loadModule(GardenCropMilestones()) diff --git a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt index 0044ed6ea..8ff09bba5 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt @@ -22,6 +22,7 @@ import at.hannibal2.skyhanni.config.core.config.Position import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsX import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsY import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getDummySize +import at.hannibal2.skyhanni.data.OtherInventoryData import at.hannibal2.skyhanni.utils.GuiRenderUtils import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.client.Minecraft @@ -40,6 +41,7 @@ class GuiPositionEditor(private val positions: List, private val borde override fun onGuiClosed() { super.onGuiClosed() clickedPos = -1 + OtherInventoryData.close() } override fun drawScreen(unusedX: Int, unusedY: Int, partialTicks: Float) { diff --git a/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt index 3a018e33a..f1cebf640 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt @@ -8,7 +8,7 @@ import net.minecraft.network.play.server.S2FPacketSetSlot import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent -class OtherInventoryData { +object OtherInventoryData { private var currentInventory: Inventory? = null private var acceptItems = false private var lateEvent: LateInventoryOpenEvent? = null @@ -18,7 +18,7 @@ class OtherInventoryData { close() } - private fun close() { + fun close() { currentInventory?.let { InventoryCloseEvent(it).postAndCatch() currentInventory = null -- cgit