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

import net.minecraft.network.chat.Component
import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
import ru.dbotthepony.mc.otm.client.screen.panels.slot.BatterySlotPanel
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.SlotPanel
import ru.dbotthepony.mc.otm.client.screen.widget.MatterGaugePanel
import ru.dbotthepony.mc.otm.client.screen.widget.PowerGaugePanel
import ru.dbotthepony.mc.otm.client.screen.widget.ProfiledMatterGaugePanel
import ru.dbotthepony.mc.otm.client.screen.widget.ProfiledPowerGaugePanel
import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel
import ru.dbotthepony.mc.otm.menu.matter.MatterReplicatorMenu

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

		val m = ProfiledPowerGaugePanel(this, frame, menu.profiledEnergy, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
		ProfiledMatterGaugePanel(this, frame, menu.matter, LEFT_MARGIN + m.width, GAUGE_TOP_WITH_SLOT)

		BatterySlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)

		ProgressGaugePanel(this, frame, menu.progress, 54f, PROGRESS_ARROW_TOP)

		for (i in 0 until 3)
			SlotPanel(this, frame, menu.storageSlots[i], 80f + i * 18, PROGRESS_SLOT_TOP)

		SlotPanel(this, frame, menu.storageSlots[3], 80f, PROGRESS_SLOT_TOP + 22f)
		SlotPanel(this, frame, menu.storageSlots[4], 80f + 18f, PROGRESS_SLOT_TOP + 22f)

		makeDeviceControls(this, frame, redstoneConfig = menu.redstoneConfig, itemConfig = menu.itemConfig, energyConfig = menu.energyConfig, upgrades = menu.upgrades)

		return frame
	}
}
