Streamline PoweredMatteryMenu API
This commit is contained in:
parent
d9ba74bc0f
commit
9f093a74ed
@ -225,8 +225,8 @@ class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: I
|
||||
override fun makeMainFrame(): FramePanel {
|
||||
val frame = super.makeMainFrame()!!
|
||||
|
||||
PowerGaugePanel(this, frame, menu.battery_widget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
SlotPanel(this, frame, menu.battery_slot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
SlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
SlotPanel(this, frame, menu.androidBattery, 38f, 17f)
|
||||
|
||||
val button = ButtonPanel(this, frame, 38f, 69f, 124f, 20f, TranslatableComponent("otm.gui.android_research"))
|
||||
|
@ -3,7 +3,6 @@ package ru.dbotthepony.mc.otm.client.screen
|
||||
import net.minecraft.network.chat.Component
|
||||
import ru.dbotthepony.mc.otm.menu.DriveRackMenu
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.PowerGaugePanel
|
||||
@ -14,8 +13,8 @@ class DriveRackScreen(menu: DriveRackMenu, inventory: Inventory, title: Componen
|
||||
override fun makeMainFrame(): FramePanel {
|
||||
val frame = super.makeMainFrame()!!
|
||||
|
||||
PowerGaugePanel(this, frame, menu.battery_widget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
SlotPanel(this, frame, menu.battery_slot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
SlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
SlotPanel(this, frame, menu.drives[0], 71f, 32f)
|
||||
SlotPanel(this, frame, menu.drives[1], 71f + 18f, 32f)
|
||||
|
@ -47,8 +47,8 @@ class DriveViewerScreen(menu: DriveViewerMenu, inventory: Inventory, title: Comp
|
||||
}
|
||||
}
|
||||
|
||||
views.add(PowerGaugePanel(this, frame, menu.battery_widget, 8f, 16f))
|
||||
views.add(SlotPanel(this, frame, menu.battery_slot, 8f, 67f))
|
||||
views.add(PowerGaugePanel(this, frame, menu.powerWidget, 8f, 16f))
|
||||
views.add(SlotPanel(this, frame, menu.batterySlot, 8f, 67f))
|
||||
views.add(SlotPanel(this, frame, menu.driveSlot, 8f, 85f))
|
||||
|
||||
val grid = GridPanel(this, frame, 28f, 16f, GRID_WIDTH * 18f, GRID_HEIGHT * 18f, GRID_WIDTH, GRID_HEIGHT)
|
||||
|
@ -13,8 +13,8 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp
|
||||
override fun makeMainFrame(): FramePanel {
|
||||
val frame = FramePanel(this, null, 0f, 0f, FRAME_WIDTH, FRAME_HEIGHT, getTitle())
|
||||
|
||||
PowerGaugePanel(this, frame, menu.battery_widget, 8f, 29f)
|
||||
SlotPanel(this, frame, menu.battery_slot, 8f, 80f)
|
||||
PowerGaugePanel(this, frame, menu.powerWidget, 8f, 29f)
|
||||
SlotPanel(this, frame, menu.batterySlot, 8f, 80f)
|
||||
|
||||
val scrollBar = ScrollBarPanel(this, frame, 192f, 14f, 92f)
|
||||
scrollBar.setupRowMultiplier { menu.view.getItemCount() / GRID_WIDTH }
|
||||
|
@ -19,10 +19,10 @@ class MatterBottlerScreen(menu: MatterBottlerMenu, inventory: Inventory, title:
|
||||
override fun makeMainFrame(): FramePanel {
|
||||
val frame = super.makeMainFrame()!!
|
||||
|
||||
val p = PowerGaugePanel(this, frame, menu.battery_widget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
val p = PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
MatterGaugePanel(this, frame, menu.matterWidget, LEFT_MARGIN + p.width, GAUGE_TOP_WITH_SLOT)
|
||||
|
||||
SlotPanel(this, frame, menu.battery_slot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
SlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
for (i in 0 .. 2) {
|
||||
SlotPanel(this, frame, menu.container[i], 31f + i * 18, PROGRESS_SLOT_TOP)
|
||||
|
@ -15,10 +15,10 @@ class MatterDecomposerScreen(p_97741_: MatterDecomposerMenu, p_97742_: Inventory
|
||||
override fun makeMainFrame(): FramePanel {
|
||||
val frame = super.makeMainFrame()!!
|
||||
|
||||
val m = PowerGaugePanel(this, frame, menu.battery_widget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
val m = PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
MatterGaugePanel(this, frame, menu.matter_widget, LEFT_MARGIN + m.width, GAUGE_TOP_WITH_SLOT)
|
||||
|
||||
SlotPanel(this, frame, menu.battery_slot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
SlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
SlotPanel(this, frame, menu.input, 56f, PROGRESS_SLOT_TOP)
|
||||
ProgressGaugePanel(this, frame, menu.progress, 78f, PROGRESS_ARROW_TOP)
|
||||
|
@ -3,7 +3,6 @@ package ru.dbotthepony.mc.otm.client.screen
|
||||
import net.minecraft.network.chat.Component
|
||||
import ru.dbotthepony.mc.otm.menu.MatterReplicatorMenu
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.MatterGaugePanel
|
||||
@ -15,10 +14,10 @@ class MatterReplicatorScreen(p_97741_: MatterReplicatorMenu, p_97742_: Inventory
|
||||
override fun makeMainFrame(): FramePanel {
|
||||
val frame = super.makeMainFrame()!!
|
||||
|
||||
val m = PowerGaugePanel(this, frame, menu.battery_widget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
val m = PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
MatterGaugePanel(this, frame, menu.matter_widget, LEFT_MARGIN + m.width, GAUGE_TOP_WITH_SLOT)
|
||||
|
||||
SlotPanel(this, frame, menu.battery_slot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
SlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
ProgressGaugePanel(this, frame, menu.progress, 54f, PROGRESS_ARROW_TOP)
|
||||
|
||||
|
@ -3,10 +3,8 @@ package ru.dbotthepony.mc.otm.client.screen
|
||||
import net.minecraft.network.chat.Component
|
||||
import ru.dbotthepony.mc.otm.menu.MatterScannerMenu
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.MatterGaugePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.PatternGaugePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.PowerGaugePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel
|
||||
@ -17,10 +15,10 @@ class MatterScannerScreen(p_97741_: MatterScannerMenu, p_97742_: Inventory, p_97
|
||||
val frame = super.makeMainFrame()!!
|
||||
|
||||
|
||||
val m = PowerGaugePanel(this, frame, menu.battery_widget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
val m = PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
PatternGaugePanel(this, frame, menu.patterns, LEFT_MARGIN + m.width, GAUGE_TOP_WITH_SLOT)
|
||||
|
||||
SlotPanel(this, frame, menu.battery_slot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
SlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
ProgressGaugePanel(this, frame, menu.progress, 63f, PROGRESS_ARROW_TOP).flop = true
|
||||
SlotPanel(this, frame, menu.input, 93f, PROGRESS_SLOT_TOP)
|
||||
|
@ -3,10 +3,7 @@ package ru.dbotthepony.mc.otm.menu
|
||||
import net.minecraft.world.inventory.MenuType
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatteryPowered
|
||||
import ru.dbotthepony.mc.otm.menu.MatteryMenu
|
||||
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
|
||||
import ru.dbotthepony.mc.otm.menu.BatterySlot
|
||||
import ru.dbotthepony.mc.otm.capability.IMatteryEnergyStorage
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryCapability
|
||||
import net.minecraft.world.SimpleContainer
|
||||
|
||||
@ -17,23 +14,24 @@ abstract class PoweredMatteryMenu protected constructor(
|
||||
tile: BlockEntityMatteryPowered? = null
|
||||
) : MatteryMenu(menuType, containerID, inventory, tile) {
|
||||
@JvmField
|
||||
val battery_widget: LevelGaugeWidget
|
||||
val powerWidget: LevelGaugeWidget
|
||||
|
||||
@JvmField
|
||||
var battery_slot: BatterySlot? = null
|
||||
var batterySlot: BatterySlot? = null
|
||||
|
||||
init {
|
||||
if (tile == null || tile.getCapability(MatteryCapability.ENERGY).resolve().isEmpty) {
|
||||
battery_widget = LevelGaugeWidget(this)
|
||||
powerWidget = LevelGaugeWidget(this)
|
||||
} else {
|
||||
battery_widget = LevelGaugeWidget(this, tile.getCapability(MatteryCapability.ENERGY).resolve().get())
|
||||
powerWidget = LevelGaugeWidget(this, tile.getCapability(MatteryCapability.ENERGY).resolve().get())
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
protected fun addBatterySlot(x: Int = 10, y: Int = 66) {
|
||||
val battery_container = if (tile is BlockEntityMatteryPowered) tile.battery_container else SimpleContainer(1)
|
||||
battery_slot = BatterySlot(battery_container, 0, x, y)
|
||||
addSlot(battery_slot!!)
|
||||
val container = if (tile is BlockEntityMatteryPowered) tile.battery_container else SimpleContainer(1)
|
||||
val batterySlot = BatterySlot(container, 0, x, y)
|
||||
addSlot(batterySlot)
|
||||
this.batterySlot = batterySlot
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user