diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt index f078f3ddb..f8e5e7963 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt @@ -44,7 +44,7 @@ object ClientEventHandler { } } - var ignoreInventoryOpen = false + var shouldOpenVanillaInventory = false fun postScreenInit(event: ScreenEvent.Init.Post) { val player = minecraft.player?.matteryPlayer ?: return @@ -55,20 +55,22 @@ object ClientEventHandler { event.addListener(Panel2Widget(LargeSquareButtonPanel(event.screen as InventoryScreen, null, x = screen.guiLeft + screen.xSize + 2f, y = screen.guiTop.toFloat(), - skinElement = Widgets18.RETURN_ARROW_LEFT, onPress = { - val mouseX = minecraft.mouseHandler.xpos() - val mouseY = minecraft.mouseHandler.ypos() + skinElement = Widgets18.RETURN_ARROW_LEFT, + onPress = { + shouldOpenVanillaInventory = false + val mouseX = minecraft.mouseHandler.xpos() + val mouseY = minecraft.mouseHandler.ypos() - event.screen.onClose() - minecraft.setScreen(ExoSuitInventoryScreen(player.exoSuitMenu)) + event.screen.onClose() + minecraft.setScreen(ExoSuitInventoryScreen(player.exoSuitMenu)) - InputConstants.grabOrReleaseMouse(minecraft.window.window, 212993, mouseX, mouseY) + InputConstants.grabOrReleaseMouse(minecraft.window.window, 212993, mouseX, mouseY) }).also { it.tooltip = TranslatableComponent("otm.gui.exosuit.go_in") })) } } fun screenOpen(event: ScreenEvent.Opening) { - if (ignoreInventoryOpen || minecraft.player?.isCreative == true) { + if (shouldOpenVanillaInventory || minecraft.player?.isCreative == true) { return } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/ExoSuitInventoryScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/ExoSuitInventoryScreen.kt index 418faf689..2b5755c40 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/ExoSuitInventoryScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/ExoSuitInventoryScreen.kt @@ -129,20 +129,16 @@ class ExoSuitInventoryScreen(menu: ExoSuitInventoryMenu) : MatteryScreen