internal void smartQuickStack()
		{
			if (player.chest != -1)
			{
				// check this chest for cateroies, then stack all items that fit those categories into this chest.

				Item[] items = player.bank.item;
				if (player.chest > -1)
				{
					items = Main.chest[player.chest].item;
				}
				else if (player.chest == -2)
				{
					items = player.bank.item;
				}
				else if (player.chest == -3)
				{
					items = player.bank2.item;
				}
				else if (player.chest == -4)
				{
					items = player.bank3.item;
				}

				bool itemMoved = false;
				List<ItemSorting.ItemSortingLayer> layersInThisChest = ItemSorting.GetPassingLayers(items);
				for (int i = 0; i < 50; i++)
				{
					Item item = player.inventory[i];
					if (item.type == ItemID.Count || item.favorited || (item.type >= 71 && item.type <= 74)) continue;
					foreach (var layer in ItemSorting.layerList)
					{
						if (layer.Pass(item))
						{
							if (layersInThisChest.Contains(layer))
							{
								itemMoved |= ChestUI.TryPlacingInChest(item, false);
								break;
							}
							else
							{
								break;
							}
						}

					}
				}
				if (itemMoved)
				{
					Main.PlaySound(7, -1, -1, 1, 1f, 0f);
				}
			}
			else
			{
				//TODO
				smartQuickStackAllChests();
				Recipe.FindRecipes();
			}
		}
        internal void smartQuickStackAllChests()
        {
            if (player.IsStackingItems())
            {
                return;
            }
            if (Main.netMode == 1)
            {
                Main.NewText("Smart Quick Stack to Nearby Chests not implemented in Multiplayer yet");
                //TODO
                return;
            }
            bool itemMoved = false;

            for (int chestIndex = 0; chestIndex < 1000; chestIndex++)
            {
                if (Main.chest[chestIndex] != null && /*!Chest.IsPlayerInChest(i) &&*/ !Chest.isLocked(Main.chest[chestIndex].x, Main.chest[chestIndex].y))
                {
                    Vector2 distanceToPlayer = new Vector2((float)(Main.chest[chestIndex].x * 16 + 16), (float)(Main.chest[chestIndex].y * 16 + 16));
                    if ((distanceToPlayer - player.Center).Length() < 200f)
                    {
                        player.chest = chestIndex;
                        Item[] items = Main.chest[chestIndex].item;
                        List <ItemSorting.ItemSortingLayer> layersInThisChest = ItemSorting.GetPassingLayers(items);
                        for (int i = 0; i < 50; i++)
                        {
                            Item item = player.inventory[i];
                            if (item.type == ItemID.Count || item.favorited || (item.type >= 71 && item.type <= 74))
                            {
                                continue;
                            }
                            foreach (var layer in ItemSorting.layerList)
                            {
                                if (layer.Pass(item))
                                {
                                    if (layersInThisChest.Contains(layer))
                                    {
                                        itemMoved |= ChestUI.TryPlacingInChest(item, false);
                                        break;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (itemMoved)
            {
                Main.PlaySound(7, -1, -1, 1, 1f, 0f);
            }
            player.chest = -1;
        }