diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/ItemMonitorScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/ItemMonitorScreen.kt index 81a145ef0..76c6e3aa8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/ItemMonitorScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/ItemMonitorScreen.kt @@ -15,6 +15,7 @@ import ru.dbotthepony.mc.otm.client.render.Widgets8 import ru.dbotthepony.mc.otm.client.screen.panels.* import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel import ru.dbotthepony.mc.otm.client.screen.widget.TallHorizontalPowerGaugePanel +import ru.dbotthepony.mc.otm.client.screen.widget.WidePowerGaugePanel import ru.dbotthepony.mc.otm.core.maxScrollDivision import ru.dbotthepony.mc.otm.core.formatReadableNumber import ru.dbotthepony.mc.otm.core.formatSiComponent @@ -187,19 +188,24 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp } } - val bottomStrip = EditablePanel(this, frame, height = AbstractSlotPanel.SIZE) - bottomStrip.dock = Dock.BOTTOM + val leftStrip = BackgroundPanel.padded(this, frame, width = AbstractSlotPanel.SIZE, height = 1f) - BatterySlotPanel(this, bottomStrip, menu.batterySlot).also { - it.dock = Dock.LEFT - it.dockRight = 3f + BatterySlotPanel(this, leftStrip, menu.batterySlot).also { + it.dock = Dock.BOTTOM + leftStrip.height += it.height } - TallHorizontalPowerGaugePanel(this, bottomStrip, menu.powerWidget).also { + WidePowerGaugePanel(this, leftStrip, menu.powerWidget).also { it.dock = Dock.FILL it.dockResize = DockResizeMode.NONE + leftStrip.height += it.height } + leftStrip.height += 3f + + leftStrip.x = -leftStrip.width - 2f + leftStrip.y = frame.height - leftStrip.height + return frame } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/BackgroundPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/BackgroundPanel.kt new file mode 100644 index 000000000..65f4c1225 --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/BackgroundPanel.kt @@ -0,0 +1,57 @@ +package ru.dbotthepony.mc.otm.client.screen.panels + +import com.mojang.blaze3d.vertex.PoseStack +import ru.dbotthepony.mc.otm.client.render.StretchingRectangleElement +import ru.dbotthepony.mc.otm.client.render.WidgetLocation +import ru.dbotthepony.mc.otm.client.render.element +import ru.dbotthepony.mc.otm.client.screen.MatteryScreen + +open class BackgroundPanel( + screen: MatteryScreen<*>, + parent: EditablePanel?, + x: Float = 0f, + y: Float = 0f, + width: Float = 10f, + height: Float = 10f, +) : EditablePanel(screen, parent, x, y, width, height) { + init { + dockPadding = DockProperty(3f, 3f, 3f, 3f) + } + + override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) { + RECTANGLE.render(stack, width = width, height = height) + } + + companion object { + fun padded( + screen: MatteryScreen<*>, + parent: EditablePanel?, + x: Float = 0f, + y: Float = 0f, + width: Float = 10f, + height: Float = 10f, + ) = BackgroundPanel(screen, parent, x, y, width + 6f, height + 6f) + + fun paddedCenter( + screen: MatteryScreen<*>, + parent: EditablePanel?, + x: Float = 0f, + y: Float = 0f, + width: Float = 10f, + height: Float = 10f, + ) = BackgroundPanel(screen, parent, x - 3f, y - 3f, width + 6f, height + 6f) + + val RECTANGLE = StretchingRectangleElement( + topLeft = WidgetLocation.WIDGETS.element(18f, 24f, 3f, 3f), + topRight = WidgetLocation.WIDGETS.element(27f, 24f, 3f, 3f), + bottomLeft = WidgetLocation.WIDGETS.element(18f, 33f, 3f, 3f), + bottomRight = WidgetLocation.WIDGETS.element(27f, 33f, 3f, 3f), + top = WidgetLocation.WIDGETS.element(21f, 24f, 6f, 2f), + bottom = WidgetLocation.WIDGETS.element(21f, 34f, 6f, 2f), + left = WidgetLocation.WIDGETS.element(18f, 27f, 2f, 6f), + right = WidgetLocation.WIDGETS.element(28f, 27f, 2f, 6f), + middle = WidgetLocation.WIDGETS.element(30f, 12f, 6f, 6f), + padding = DockProperty(-1f, -1f, -1f, -1f) + ) + } +} diff --git a/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets.png b/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets.png index de2812a3d..97c810a1d 100644 Binary files a/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets.png and b/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets.png differ diff --git a/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets.xcf b/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets.xcf index d92884c98..1048cb96b 100644 --- a/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets.xcf +++ b/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets.xcf @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7b4c94442e8d563837693ab8743838a20c8643979d2e0be369d0784c9a5b9a6a -size 52633 +oid sha256:d1107b9cc8a1a50c4a167b9c8926ed9780a42280eaa97f8ae431f22ff9f34129 +size 53271