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

		addStorageSlot(batterySlot)
		addInventorySlots()
	}
}
