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

import net.minecraft.network.chat.Component
import ru.dbotthepony.mc.otm.menu.matter.PatternStorageMenu
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.PatternSlotPanel
import ru.dbotthepony.mc.otm.client.screen.widget.PatternGaugePanel

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

		val m = PatternGaugePanel(this, frame, menu.storedThis, LEFT_MARGIN, GAUGE_TOP_WITHOUT_SLOT)
		PatternGaugePanel(this, frame, menu.storedGrid, LEFT_MARGIN + m.width, GAUGE_TOP_WITHOUT_SLOT)

		for (i in 0 until 4)
			PatternSlotPanel(this, frame, menu.storageSlots[i], 62f + i * 18, 32f)

		for (i in 4 until 8)
			PatternSlotPanel(this, frame, menu.storageSlots[i], 62f + (i - 4) * 18, 32f + 18f)

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

		return frame
	}
}
