Update storage power supplier menu

This commit is contained in:
DBotThePony 2023-08-12 14:55:37 +07:00
parent 6c7f2226a6
commit 71c5e788c6
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -2,13 +2,15 @@ package ru.dbotthepony.mc.otm.client.screen.storage
import net.minecraft.network.chat.Component
import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.client.ShiftPressedCond
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.client.screen.panels.*
import ru.dbotthepony.mc.otm.client.screen.panels.button.makeDeviceControls
import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel
import ru.dbotthepony.mc.otm.client.screen.panels.slot.BatterySlotPanel
import ru.dbotthepony.mc.otm.client.screen.widget.HorizontalPowerGaugePanel
import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel
import ru.dbotthepony.mc.otm.client.screen.widget.TallHorizontalPowerGaugePanel
import ru.dbotthepony.mc.otm.core.util.formatPower
import ru.dbotthepony.mc.otm.menu.storage.StoragePowerSupplierMenu
@ -16,29 +18,35 @@ import ru.dbotthepony.mc.otm.menu.storage.StoragePowerSupplierMenu
class StoragePowerSupplierScreen(menu: StoragePowerSupplierMenu, inventory: Inventory, title: Component) :
MatteryScreen<StoragePowerSupplierMenu>(menu, inventory, title) {
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
val frame = FramePanel(this, width = 200f, height = 60f, title)
val frame = FramePanel(this, width = 200f, height = 68f, title)
frame.makeCloseButton()
frame.onClose { onClose() }
HorizontalPowerGaugePanel(this, frame, menu.energyWidget).also {
it.dock = Dock.BOTTOM
it.dockResize = DockResizeMode.NONE
}
val strip = EditablePanel(this, frame, height = AbstractSlotPanel.SIZE)
val topStrip = EditablePanel(this, frame, height = AbstractSlotPanel.SIZE)
strip.dock = Dock.BOTTOM
strip.dockTop = 3f
topStrip.dock = Dock.TOP
topStrip.dockTop = 3f
BatterySlotPanel(this, topStrip, menu.batterySlot).also {
BatterySlotPanel(this, strip, menu.batterySlot).also {
it.dock = Dock.LEFT
it.dockRight = 3f
}
val labels = EditablePanel(this, topStrip)
SpritePanel(this, strip, ProgressGaugePanel.GAUGE_BACKGROUND).also {
it.dock = Dock.LEFT
it.dockRight = 3f
it.dockResize = DockResizeMode.NONE
}
TallHorizontalPowerGaugePanel(this, strip, menu.energyWidget).also {
it.dock = Dock.LEFT
it.dockResize = DockResizeMode.NONE
}
val labels = EditablePanel(this, frame)
labels.dock = Dock.FILL
labels.dockTop = 4f
object : Label<StoragePowerSupplierScreen>(this@StoragePowerSupplierScreen, labels) {
init {
@ -50,7 +58,7 @@ class StoragePowerSupplierScreen(menu: StoragePowerSupplierMenu, inventory: Inve
text = TranslatableComponent(
"otm.item.power.passed",
menu.totalTransferred.formatPower()
menu.totalTransferred.formatPower(formatAsReadable = ShiftPressedCond)
)
}
}