From 90dc9060cf7e0e6d4a0dbab2bb9458cda2974c2c Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Wed, 5 Jul 2023 17:45:09 +0700 Subject: [PATCH] Add missing close buttons --- .../mc/otm/client/screen/decorative/CargoCrateScreen.kt | 4 ++++ .../mc/otm/client/screen/decorative/HoloSignScreen.kt | 3 +++ .../otm/client/screen/decorative/MinecartCargoCrateScreen.kt | 4 ++++ .../mc/otm/client/screen/matter/MatterPanelScreen.kt | 3 +++ .../mc/otm/client/screen/storage/DriveViewerScreen.kt | 4 +++- .../mc/otm/client/screen/storage/ItemMonitorScreen.kt | 3 +++ .../mc/otm/client/screen/storage/StorageBusScreen.kt | 2 +- .../mc/otm/client/screen/storage/StorageExporterScreen.kt | 2 +- .../mc/otm/client/screen/storage/StorageImporterScreen.kt | 2 +- .../otm/client/screen/storage/StoragePowerSupplierScreen.kt | 3 +++ .../mc/otm/client/screen/tech/AndroidStationScreen.kt | 3 +++ .../mc/otm/client/screen/tech/EnergyServoScreen.kt | 3 +++ .../mc/otm/client/screen/tech/EssenceStorageScreen.kt | 3 +++ 13 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/CargoCrateScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/CargoCrateScreen.kt index a3febd6c8..bd81403cf 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/CargoCrateScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/CargoCrateScreen.kt @@ -12,6 +12,10 @@ import ru.dbotthepony.mc.otm.menu.decorative.CargoCrateMenu class CargoCrateScreen(menu: CargoCrateMenu, inventory: Inventory, title: Component) : MatteryScreen(menu, inventory, title) { override fun makeMainFrame(): FramePanel> { val frame = FramePanel(this, null, 0f, 0f, INVENTORY_FRAME_WIDTH, 22f + 4f + 6f * 18f, getTitle()) + + frame.makeCloseButton() + frame.onClose { onClose() } + val grid = GridPanel(this, frame, 8f, 18f, 9f * 18f, 6f * 18f, 9, 6) for (slot in menu.storageSlots) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/HoloSignScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/HoloSignScreen.kt index 217ec4f57..059286d25 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/HoloSignScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/HoloSignScreen.kt @@ -16,6 +16,9 @@ class HoloSignScreen(menu: HoloSignMenu, inventory: Inventory, title: Component) override fun makeMainFrame(): FramePanel> { val frame = FramePanel(this, null, 0f, 0f, 200f, 200f, getTitle()) + frame.makeCloseButton() + frame.onClose { onClose() } + val input = NetworkedStringInputPanel(this, frame, backend = menu.text) input.dock = Dock.FILL input.multiLine = true diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/MinecartCargoCrateScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/MinecartCargoCrateScreen.kt index 5e938ac69..c274f233a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/MinecartCargoCrateScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/MinecartCargoCrateScreen.kt @@ -11,6 +11,10 @@ import ru.dbotthepony.mc.otm.menu.decorative.MinecartCargoCrateMenu class MinecartCargoCrateScreen(menu: MinecartCargoCrateMenu, inventory: Inventory, title: Component) : MatteryScreen(menu, inventory, title) { override fun makeMainFrame(): FramePanel> { val frame = FramePanel(this, null, 0f, 0f, INVENTORY_FRAME_WIDTH, 22f + 4f + 6f * 18f, getTitle()) + + frame.makeCloseButton() + frame.onClose { onClose() } + val grid = GridPanel(this, frame, 8f, 18f, 9f * 18f, 6f * 18f, 9, 6) for (slot in menu.storageSlots) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterPanelScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterPanelScreen.kt index 9f16c5b60..38bc40dcb 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterPanelScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterPanelScreen.kt @@ -49,6 +49,9 @@ class MatterPanelScreen( val frame = FramePanel.padded(this, null, GRID_WIDTH * AbstractSlotPanel.SIZE + ScrollBarConstants.WIDTH + 4f, GRID_HEIGHT * AbstractSlotPanel.SIZE + 2f, title) frame.dockPadding = frame.dockPadding.copy(top = frame.dockPadding.top + 2f) + frame.makeCloseButton() + frame.onClose { onClose() } + val controls = DeviceControls(this, frame) LargeBooleanRectangleButtonPanel(this, controls, diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/DriveViewerScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/DriveViewerScreen.kt index 4f34c313b..f08354adb 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/DriveViewerScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/DriveViewerScreen.kt @@ -1,6 +1,5 @@ package ru.dbotthepony.mc.otm.client.screen.storage -import com.mojang.blaze3d.vertex.PoseStack import net.minecraft.client.gui.GuiGraphics import net.minecraft.network.chat.Component import net.minecraft.world.entity.player.Inventory @@ -28,6 +27,9 @@ class DriveViewerScreen(menu: DriveViewerMenu, inventory: Inventory, title: Comp override fun makeMainFrame(): FramePanel> { val frame = FramePanel(this, null, 0f, 0f, FRAME_WIDTH, FRAME_HEIGHT, getTitle()) + frame.makeCloseButton() + frame.onClose { onClose() } + val views = ArrayList>() val settings = ArrayList>() diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/ItemMonitorScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/ItemMonitorScreen.kt index e66f2b2fd..965518f7c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/ItemMonitorScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/ItemMonitorScreen.kt @@ -42,6 +42,9 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp override fun makeMainFrame(): FramePanel> { val frame = FramePanel(this@ItemMonitorScreen, null, 0f, 0f, 1f, 1f, getTitle()) + frame.makeCloseButton() + frame.onClose { onClose() } + val topPanel = EditablePanel(this, frame) topPanel.height = ITEM_GRID_HEIGHT * 18f topPanel.dock = Dock.TOP diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/StorageBusScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/StorageBusScreen.kt index 71e3497d2..17eddc453 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/StorageBusScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/StorageBusScreen.kt @@ -15,7 +15,7 @@ import ru.dbotthepony.mc.otm.menu.storage.StorageBusMenu class StorageBusScreen(menu: StorageBusMenu, inventory: Inventory, title: Component) : MatteryScreen(menu, inventory, title) { - override fun makeMainFrame(): FramePanel> { + override fun makeMainFrame(): FramePanel> { val frame = super.makeMainFrame()!! WidePowerGaugePanel(this, frame, menu.energyWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/StorageExporterScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/StorageExporterScreen.kt index 8299b3879..6b4b7dbdc 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/StorageExporterScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/StorageExporterScreen.kt @@ -15,7 +15,7 @@ import ru.dbotthepony.mc.otm.menu.storage.StorageExporterMenu class StorageExporterScreen(menu: StorageExporterMenu, inventory: Inventory, title: Component) : MatteryScreen(menu, inventory, title) { - override fun makeMainFrame(): FramePanel> { + override fun makeMainFrame(): FramePanel> { val frame = super.makeMainFrame()!! WidePowerGaugePanel(this, frame, menu.energyWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/StorageImporterScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/StorageImporterScreen.kt index 97ad88d5e..ecbb2f538 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/StorageImporterScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/StorageImporterScreen.kt @@ -15,7 +15,7 @@ import ru.dbotthepony.mc.otm.menu.storage.StorageImporterMenu class StorageImporterScreen(menu: StorageImporterMenu, inventory: Inventory, title: Component) : MatteryScreen(menu, inventory, title) { - override fun makeMainFrame(): FramePanel> { + override fun makeMainFrame(): FramePanel> { val frame = super.makeMainFrame()!! WidePowerGaugePanel(this, frame, menu.energyWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/StoragePowerSupplierScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/StoragePowerSupplierScreen.kt index 69a5f9cf3..f9eb3e7ce 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/StoragePowerSupplierScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/StoragePowerSupplierScreen.kt @@ -18,6 +18,9 @@ class StoragePowerSupplierScreen(menu: StoragePowerSupplierMenu, inventory: Inve override fun makeMainFrame(): FramePanel> { val frame = FramePanel(this, width = 200f, height = 60f, title) + frame.makeCloseButton() + frame.onClose { onClose() } + HorizontalPowerGaugePanel(this, frame, menu.energyWidget).also { it.dock = Dock.BOTTOM it.dockResize = DockResizeMode.NONE diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt index 16d955ba2..a937153ab 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt @@ -656,6 +656,9 @@ class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: I override fun makeMainFrame(): FramePanel { val frame = FramePanel(this, 200f, 108f, title) + frame.makeCloseButton() + frame.onClose { onClose() } + object : Label(this@AndroidStationScreen, frame, height = 11f, shadow = true) { init { dock = Dock.BOTTOM diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EnergyServoScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EnergyServoScreen.kt index 1a353dc7f..e6a65370d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EnergyServoScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EnergyServoScreen.kt @@ -25,6 +25,9 @@ class EnergyServoScreen(menu: EnergyServoMenu, inventory: Inventory, title: Comp width = AbstractSlotPanel.SIZE * 2f + HorizontalPowerGaugePanel.GAUGE_BACKGROUND_TALL.width + 8f + ProgressGaugePanel.GAUGE_BACKGROUND.width * 2f, AbstractSlotPanel.SIZE + PlayerEquipmentPanel.HEIGHT + 4f, title) + frame.makeCloseButton() + frame.onClose { onClose() } + val equipment = PlayerEquipmentPanel(this, frame, armorSlots = menu.equipment.armorSlots) equipment.dock = Dock.FILL equipment.dockResize = DockResizeMode.NONE diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EssenceStorageScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EssenceStorageScreen.kt index f8e45312c..2ae976f46 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EssenceStorageScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EssenceStorageScreen.kt @@ -34,6 +34,9 @@ class EssenceStorageScreen(menu: EssenceStorageMenu, inventory: Inventory, title override fun makeMainFrame(): FramePanel> { val frame = FramePanel.padded(this, width = DEFAULT_FRAME_WIDTH, height = 18f * 2f + 36f + 25f, title) + frame.makeCloseButton() + frame.onClose { onClose() } + val inputs = HorizontalStripPanel(this, frame, height = 18f) inputs.dock = Dock.TOP inputs.dockMargin = DockProperty(bottom = 3f, top = 3f)