/// <summary>
        /// Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack
        /// </summary>
        public virtual void SmeltItem()
        {
            if (!CanSmelt())
            {
                return;
            }

            ItemStack itemstack = FurnaceRecipes.Smelting().GetSmeltingResult(FurnaceItemStacks[0].GetItem().ShiftedIndex);

            if (FurnaceItemStacks[2] == null)
            {
                FurnaceItemStacks[2] = itemstack.Copy();
            }
            else if (FurnaceItemStacks[2].ItemID == itemstack.ItemID)
            {
                FurnaceItemStacks[2].StackSize++;
            }

            FurnaceItemStacks[0].StackSize--;

            if (FurnaceItemStacks[0].StackSize <= 0)
            {
                FurnaceItemStacks[0] = null;
            }
        }
        /// <summary>
        /// Returns true if the furnace can smelt an item, i.e. has a source item, destination stack isn't full, etc.
        /// </summary>
        private bool CanSmelt()
        {
            if (FurnaceItemStacks[0] == null)
            {
                return(false);
            }

            ItemStack itemstack = FurnaceRecipes.Smelting().GetSmeltingResult(FurnaceItemStacks[0].GetItem().ShiftedIndex);

            if (itemstack == null)
            {
                return(false);
            }

            if (FurnaceItemStacks[2] == null)
            {
                return(true);
            }

            if (!FurnaceItemStacks[2].IsItemEqual(itemstack))
            {
                return(false);
            }

            if (FurnaceItemStacks[2].StackSize < GetInventoryStackLimit() && FurnaceItemStacks[2].StackSize < FurnaceItemStacks[2].GetMaxStackSize())
            {
                return(true);
            }

            return(FurnaceItemStacks[2].StackSize < itemstack.GetMaxStackSize());
        }
        /// <summary>
        /// Called to transfer a stack from one inventory to the other eg. when shift clicking.
        /// </summary>
        public override ItemStack TransferStackInSlot(int par1)
        {
            ItemStack itemstack = null;
            Slot      slot      = (Slot)InventorySlots[par1];

            if (slot != null && slot.GetHasStack())
            {
                ItemStack itemstack1 = slot.GetStack();
                itemstack = itemstack1.Copy();

                if (par1 == 2)
                {
                    if (!MergeItemStack(itemstack1, 3, 39, true))
                    {
                        return(null);
                    }

                    slot.Func_48433_a(itemstack1, itemstack);
                }
                else if (par1 == 1 || par1 == 0)
                {
                    if (!MergeItemStack(itemstack1, 3, 39, false))
                    {
                        return(null);
                    }
                }
                else if (FurnaceRecipes.Smelting().GetSmeltingResult(itemstack1.GetItem().ShiftedIndex) != null)
                {
                    if (!MergeItemStack(itemstack1, 0, 1, false))
                    {
                        return(null);
                    }
                }
                else if (TileEntityFurnace.Func_52005_b(itemstack1))
                {
                    if (!MergeItemStack(itemstack1, 1, 2, false))
                    {
                        return(null);
                    }
                }
                else if (par1 >= 3 && par1 < 30)
                {
                    if (!MergeItemStack(itemstack1, 30, 39, false))
                    {
                        return(null);
                    }
                }
                else if (par1 >= 30 && par1 < 39 && !MergeItemStack(itemstack1, 3, 30, false))
                {
                    return(null);
                }

                if (itemstack1.StackSize == 0)
                {
                    slot.PutStack(null);
                }
                else
                {
                    slot.OnSlotChanged();
                }

                if (itemstack1.StackSize != itemstack.StackSize)
                {
                    slot.OnPickupFromSlot(itemstack1);
                }
                else
                {
                    return(null);
                }
            }

            return(itemstack);
        }