| package li.cil.oc.common.container |
| import cpw.mods.fml.relauncher.{Side, SideOnly} |
| import net.minecraft.entity.player.EntityPlayer |
| import net.minecraft.inventory.Slot |
| import net.minecraft.item.ItemStack |
| import net.minecraft.util.IIcon |
| import scala.collection.convert.WrapAsScala._ |
| trait ComponentSlot extends Slot { |
| // ----------------------------------------------------------------------- // |
| override def func_111238_b() = slot != common.Slot.None && tier != common.Tier.None && super.func_111238_b() |
| override def isItemValid(stack: ItemStack) = inventory.isItemValidForSlot(getSlotIndex, stack) |
| override def onPickupFromSlot(player: EntityPlayer, stack: ItemStack) { |
| super.onPickupFromSlot(player, stack) |
| for (slot <- container.inventorySlots) slot match { |
| case dynamic: ComponentSlot => dynamic.clearIfInvalid(player) |
| override def onSlotChanged() { |
| for (slot <- container.inventorySlots) slot match { |
| case dynamic: ComponentSlot => dynamic.clearIfInvalid(container.playerInventory.player) |
| protected def clearIfInvalid(player: EntityPlayer) {} |