package ru.dbotthepony.mc.otm.container

import net.minecraft.world.inventory.CraftingContainer
import net.minecraft.world.item.ItemStack

open class MatteryCraftingContainer(watcher: Runnable, private val width: Int, private val height: Int) : MatteryContainer(watcher, width * height), CraftingContainer {
	constructor(width: Int, height: Int) : this({}, width, height)
	final override fun getWidth(): Int {
		return width
	}

	final override fun getHeight(): Int {
		return height
	}

	final override fun getItems(): MutableList<ItemStack> {
		val i = spliterator()
		val result = ArrayList<ItemStack>(i.estimateSize().toInt())
		i.forEachRemaining { result.add(it) }
		return result
	}
}
