package info.jbcs.minecraft.chisel;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;

public class SlotChiselSelection extends Slot {
	public SlotChiselSelection(InventoryChiselSelection inv,IInventory iinventory,int i,int j,int k) {
		super(iinventory, i, j, k);

		selInventory = inv;
	}

	@Override public boolean isItemValid(ItemStack itemstack) {
		return false;
	}

	@Override public void onPickupFromSlot(EntityPlayer player,ItemStack itemstack) {
		putStack(new ItemStack(itemstack.itemID, itemstack.stackSize, itemstack.getItemDamage()));

		super.onPickupFromSlot(player,itemstack);

		player.inventory.setItemStack(null);

		if(selInventory.items[16]==null) return;

		player.inventory.setItemStack(new ItemStack(itemstack.itemID, selInventory.items[16].stackSize, itemstack.getItemDamage()));
		selInventory.setInventorySlotContents(16,null);

		selInventory.updateItems();

		player.worldObj.playSoundAtEntity(player, "random.chisel", 0.3f, 0.6f);
	}

	InventoryChiselSelection	selInventory;
}
