Attach exosuit button to screen if is for inventorymenu
This commit is contained in:
parent
d60bc916c8
commit
39f4edb857
@ -1,7 +1,10 @@
|
|||||||
package ru.dbotthepony.mc.otm.client
|
package ru.dbotthepony.mc.otm.client
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.InputConstants
|
import com.mojang.blaze3d.platform.InputConstants
|
||||||
|
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
|
||||||
import net.minecraft.client.gui.screens.inventory.InventoryScreen
|
import net.minecraft.client.gui.screens.inventory.InventoryScreen
|
||||||
|
import net.minecraft.world.inventory.AbstractContainerMenu
|
||||||
|
import net.minecraft.world.inventory.InventoryMenu
|
||||||
import net.minecraftforge.client.event.ClientPlayerNetworkEvent
|
import net.minecraftforge.client.event.ClientPlayerNetworkEvent
|
||||||
import net.minecraftforge.client.event.MovementInputUpdateEvent
|
import net.minecraftforge.client.event.MovementInputUpdateEvent
|
||||||
import net.minecraftforge.client.event.ScreenEvent
|
import net.minecraftforge.client.event.ScreenEvent
|
||||||
@ -58,7 +61,8 @@ var shouldOpenVanillaInventory = false
|
|||||||
fun onPostScreenInit(event: ScreenEvent.Init.Post) {
|
fun onPostScreenInit(event: ScreenEvent.Init.Post) {
|
||||||
val player = minecraft.player?.matteryPlayer ?: return
|
val player = minecraft.player?.matteryPlayer ?: return
|
||||||
|
|
||||||
val screen = event.screen as? InventoryScreen ?: return
|
val eventScreen = event.screen
|
||||||
|
val screen = if (eventScreen is AbstractContainerScreen<*> && eventScreen.menu is InventoryMenu) eventScreen else return
|
||||||
|
|
||||||
if (player.hasExoSuit) {
|
if (player.hasExoSuit) {
|
||||||
val widget = Panel2Widget(LargeRectangleButtonPanel(screen, null,
|
val widget = Panel2Widget(LargeRectangleButtonPanel(screen, null,
|
||||||
|
Loading…
Reference in New Issue
Block a user