@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotnumber)
{
ItemStack itemstack = null;
Slot slot = (Slot) inventorySlots.get(slotnumber);
if (slot != null && slot.getHasStack())
{
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if (inventoryTileEntity.isItemValidForSlot(0, itemstack1))
{
if (slotnumber == 1 || slotnumber == 0)
{
if (!mergeItemStack(itemstack1, 3, 38, false))
return null;
} else if (slotnumber != 1 && slotnumber != 0)
{
if (!mergeItemStack(itemstack1, 0, 1, false))
return null;
}
if (itemstack1.stackSize == 0)
{
slot.putStack(null);
} else
{
slot.onSlotChanged();
}
} else
{
return null;
}