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.StorageImporterBlockEntity
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 StorageImporterMenu @JvmOverloads constructor(
	p_38852_: Int,
	inventory: Inventory,
	tile: StorageImporterBlockEntity? = null
) : MatteryPoweredMenu(
	MMenus.STORAGE_IMPORTER, 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(StorageImporterBlockEntity.MAX_FILTERS)
			busFilterState = BooleanInputWithFeedback(this)
		}

		addInventorySlots()
	}
}
