Update storage power supplier menu
This commit is contained in:
parent
6c7f2226a6
commit
71c5e788c6
@ -2,13 +2,15 @@ package ru.dbotthepony.mc.otm.client.screen.storage
|
|||||||
|
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.world.entity.player.Inventory
|
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.client.screen.MatteryScreen
|
||||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.*
|
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.button.makeDeviceControls
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel
|
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.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.core.util.formatPower
|
||||||
|
|
||||||
import ru.dbotthepony.mc.otm.menu.storage.StoragePowerSupplierMenu
|
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) :
|
class StoragePowerSupplierScreen(menu: StoragePowerSupplierMenu, inventory: Inventory, title: Component) :
|
||||||
MatteryScreen<StoragePowerSupplierMenu>(menu, inventory, title) {
|
MatteryScreen<StoragePowerSupplierMenu>(menu, inventory, title) {
|
||||||
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
|
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.makeCloseButton()
|
||||||
frame.onClose { onClose() }
|
frame.onClose { onClose() }
|
||||||
|
|
||||||
HorizontalPowerGaugePanel(this, frame, menu.energyWidget).also {
|
val strip = EditablePanel(this, frame, height = AbstractSlotPanel.SIZE)
|
||||||
it.dock = Dock.BOTTOM
|
|
||||||
it.dockResize = DockResizeMode.NONE
|
|
||||||
}
|
|
||||||
|
|
||||||
val topStrip = EditablePanel(this, frame, height = AbstractSlotPanel.SIZE)
|
strip.dock = Dock.BOTTOM
|
||||||
|
strip.dockTop = 3f
|
||||||
|
|
||||||
topStrip.dock = Dock.TOP
|
BatterySlotPanel(this, strip, menu.batterySlot).also {
|
||||||
topStrip.dockTop = 3f
|
|
||||||
|
|
||||||
BatterySlotPanel(this, topStrip, menu.batterySlot).also {
|
|
||||||
it.dock = Dock.LEFT
|
it.dock = Dock.LEFT
|
||||||
it.dockRight = 3f
|
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.dock = Dock.FILL
|
||||||
|
labels.dockTop = 4f
|
||||||
|
|
||||||
object : Label<StoragePowerSupplierScreen>(this@StoragePowerSupplierScreen, labels) {
|
object : Label<StoragePowerSupplierScreen>(this@StoragePowerSupplierScreen, labels) {
|
||||||
init {
|
init {
|
||||||
@ -50,7 +58,7 @@ class StoragePowerSupplierScreen(menu: StoragePowerSupplierMenu, inventory: Inve
|
|||||||
|
|
||||||
text = TranslatableComponent(
|
text = TranslatableComponent(
|
||||||
"otm.item.power.passed",
|
"otm.item.power.passed",
|
||||||
menu.totalTransferred.formatPower()
|
menu.totalTransferred.formatPower(formatAsReadable = ShiftPressedCond)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user