package ru.dbotthepony.mc.otm.client.screen.panels.slot

import net.minecraft.world.item.ItemStack
import ru.dbotthepony.kommons.util.Delegate
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel

open class FilterSlotPanel<out S : MatteryScreen<*>> @JvmOverloads constructor(
	screen: S,
	parent: EditablePanel<*>?,
	val slot: Delegate<ItemStack>,
	x: Float = 0f,
	y: Float = 0f,
	width: Float = SIZE,
	height: Float = SIZE
) : AbstractSlotPanel<S>(screen, parent, x, y, width, height) {
	override val itemStack: ItemStack get() {
		return slot.get()
	}

	override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
		slot.accept(screen.menu.carried)
		return true
	}
}
