package net.geforcemods.securitycraft.containers;

import net.geforcemods.securitycraft.SCContent;
import net.geforcemods.securitycraft.tileentity.ProjectorTileEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class ProjectorContainer extends Container {

	public static final int SIZE = 1;

	public ProjectorTileEntity te;

	// A custom slot that prevents non-Block items from being inserted into the projector
	private Slot projectedItemSlot;

	public ProjectorContainer(int windowId, World world, BlockPos pos, PlayerInventory inventory) 
	{
		super(SCContent.cTypeProjector, windowId);

		if(world.getTileEntity(pos) instanceof ProjectorTileEntity)
			te = (ProjectorTileEntity) world.getTileEntity(pos);

		for(int i = 0; i < 9; i++)
			addSlot(new Slot(inventory, i, 8 + i * 18, 142));

		projectedItemSlot = new Slot(te, 9, 79, 20) 
		{
			@Override
			public boolean isItemValid(ItemStack stack) 
			{
				return stack.getItem() != null && stack.getItem() instanceof BlockItem;
			}
		};

		addSlot(new Slot(te, 9, 79, 20));
	}

	@Override
	public boolean canInteractWith(PlayerEntity playerIn) 
	{
		return true;
	}

}

@@ -637,129 +637,8 @@
 e;%0A%0A
-%09// A custom slot that prevents non-Block items from being inserted into the projector%0A%09private Slot projectedItemSlot;%0A%0A
 %09pub
@@ -727,17 +727,16 @@
 ventory)
- 
 %0A%09%7B%0A%09%09su
@@ -985,28 +985,104 @@
 %0A%0A%09%09
-projectedItem
+// A custom slot that prevents non-Block items from being inserted into the projector%0A%09%09add
 Slot
- = 
+(
 new 
@@ -1100,17 +1100,16 @@
  79, 20)
- 
 %0A%09%09%7B%0A%09%09%09
@@ -1164,17 +1164,16 @@
 k stack)
- 
 %0A%09%09%09%7B%0A%09%09
@@ -1200,35 +1200,8 @@
 em()
- != null && stack.getItem()
  ins
@@ -1231,44 +1231,8 @@
 %0A%09%09%7D
-;%0A%0A%09%09addSlot(new Slot(te, 9, 79, 20)
 );%0A%09
@@ -1299,17 +1299,16 @@
 layerIn)
- 
 %0A%09%7B%0A%09%09re

fix BlockItem restricted projector slot not showing up