public static bool EquipTool(this Farmer farmer, ToolType type) { var items = farmer.GetHotbar(); for (var index = 0; index < items.Length; index++) { var item = items[index]; if (item == null) { continue; } if (item.GetToolType() == type) { farmer.EquipItemAt(index); } } return(false); }