public int LoadContents(StardewValley.Farmer player) { int numItemsLoaded = 0; if (player.ActiveObject != null) { foreach (var container in _buildingInfo.ReadyToLoadContainers) { if (player.ActiveObject != null) { //this.Monitor.Log($" {player.Name} is holding {player.ActiveObject.Name} so placing it in container {container.Name}."); if (container.performObjectDropInAction(player.ActiveObject, false, player)) { player.reduceActiveItemByOne(); numItemsLoaded++; } else { Utility.Log($" Unable to load item. Container {container.Name} does not accept items of type {player.ActiveObject.Name}."); } } else { Utility.Log($" {player.Name} has run out of items to load. Stopping load."); break; } } } else { Utility.Log($" {player.Name} is not holding an item, so not loading containers."); } return(numItemsLoaded); }