public Item TryExtractItem(ContainerNode input, NetCollection <Item> itemList) { //Exception for multiple thread collisions Item source = itemList.Last(); Item tosend = null; if (source is SObject) { SObject obj = (SObject)source; SObject tosendObject = (SObject)tosend; if (input.CanRecieveItem(source)) { tosendObject = obj; itemList.Remove(itemList.Last()); Farm.lastItemShipped = itemList.Last(); if (itemList.Count == 1) { Farm.lastItemShipped = null; } else { Farm.lastItemShipped = itemList.Last(); } return(tosendObject); } } else if (source is Tool) { /* * Tool tool = (Tool)source; * Tool tosendTool = (Tool)tosend; * if (input.CanRecieveItems()) * { * tosendTool = tool; * itemList.RemoveAt(index); * } * Chest.clearNulls(); */ return(null); } return(null); }