blob: 7228797bc92afe5427f0a78a0791421f9ef6e041 [file] [log] [blame] [raw]
package li.cil.oc.common.tileentity
import li.cil.oc.Config
import li.cil.oc.api.driver.Slot
import li.cil.oc.server.component
import li.cil.oc.server.driver.Registry
import net.minecraft.item.ItemStack
class Case(isClient: Boolean) extends Computer {
def this() = this(false)
// ----------------------------------------------------------------------- //
val instance = if (isClient) null else new component.Computer(this)
// ----------------------------------------------------------------------- //
def getInvName = Config.namespace + "container.Case"
def getSizeInventory = 8
def isItemValidForSlot(slot: Int, item: ItemStack) = (slot, Registry.driverFor(item)) match {
case (_, None) => false // Invalid item.
case (0, Some(driver)) => driver.slot(item) == Slot.Power
case (1 | 2 | 3, Some(driver)) => driver.slot(item) == Slot.Card
case (4 | 5, Some(driver)) => driver.slot(item) == Slot.Memory
case (6 | 7, Some(driver)) => driver.slot(item) == Slot.HardDiskDrive
case _ => false // Invalid slot.
}
}