package ru.dbotthepony.mc.otm.client.screen.matter

import net.minecraft.network.chat.Component
import ru.dbotthepony.mc.otm.menu.matter.MatterCapacitorBankMenu
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.button.makeDeviceControls
import ru.dbotthepony.mc.otm.client.screen.panels.slot.MatterCapacitorSlotPanel
import ru.dbotthepony.mc.otm.client.screen.widget.MatterGaugePanel

class MatterCapacitorBankScreen(p_97741_: MatterCapacitorBankMenu, p_97742_: Inventory, p_97743_: Component) :
	MatteryScreen<MatterCapacitorBankMenu>(p_97741_, p_97742_, p_97743_) {
	override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
		val frame = super.makeMainFrame()!!

		val m = MatterGaugePanel(this, frame, menu.matterGauge, LEFT_MARGIN, GAUGE_TOP_WITHOUT_SLOT)
		MatterGaugePanel(this, frame, menu.totalMatterGauge, LEFT_MARGIN + m.width, GAUGE_TOP_WITHOUT_SLOT)

		for (i in 0 .. 5)
			MatterCapacitorSlotPanel(this, frame, menu.storageSlots[i], 44f + 18 * i, 32f)

		for (i in 6 .. 11)
			MatterCapacitorSlotPanel(this, frame, menu.storageSlots[i], 44f + 18 * (i - 6), 32f + 18f)

		makeDeviceControls(this, frame, itemConfig = menu.itemConfig)

		return frame
	}
}
