package ru.dbotthepony.mc.otm.menu.storage

import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.inventory.Slot
import ru.dbotthepony.mc.otm.block.entity.storage.StorageExporterBlockEntity
import ru.dbotthepony.mc.otm.container.ItemFilterNetworkSlot
import ru.dbotthepony.mc.otm.menu.MatteryPoweredMenu
import ru.dbotthepony.mc.otm.menu.input.BooleanInputWithFeedback
import ru.dbotthepony.mc.otm.registry.MMenus

class StorageExporterMenu @JvmOverloads constructor(
	p_38852_: Int,
	inventory: Inventory,
	tile: StorageExporterBlockEntity? = null
) : MatteryPoweredMenu(
	MMenus.STORAGE_EXPORTER, p_38852_, inventory, tile
)  {
	val busFilterSlots: List<ItemFilterNetworkSlot>
	val busFilterState: BooleanInputWithFeedback

	init {
		if (tile != null) {
			busFilterSlots = addFilterSlots(tile.filter)
			busFilterState = BooleanInputWithFeedback(this, tile.filter::isWhitelist)
		} else {
			busFilterSlots = addFilterSlots(StorageExporterBlockEntity.MAX_FILTERS)
			busFilterState = BooleanInputWithFeedback(this)
		}

		addInventorySlots()
	}
}
