Terraria.UI.ItemSlot.DyeSwap C# (CSharp) Method

DyeSwap() private static method

private static DyeSwap ( System.Item item, bool &success ) : System.Item
item System.Item
success bool
return System.Item
        private static Item DyeSwap(Item item, out bool success)
        {
            success = false;
            if ((int)item.dye <= 0)
                return item;
            Player player = Main.player[Main.myPlayer];
            for (int index = 0; index < 10; ++index)
            {
                if (player.dye[index].itemId == 0)
                {
                    ItemSlot.dyeSlotCount = index;
                    break;
                }
            }
            if (ItemSlot.dyeSlotCount >= 10)
                ItemSlot.dyeSlotCount = 0;
            if (ItemSlot.dyeSlotCount < 0)
                ItemSlot.dyeSlotCount = 9;
            Item obj = player.dye[ItemSlot.dyeSlotCount].Clone();
            player.dye[ItemSlot.dyeSlotCount] = item.Clone();
            ++ItemSlot.dyeSlotCount;
            if (ItemSlot.dyeSlotCount >= 10)
                ItemSlot.accSlotCount = 0;
            Main.PlaySound(7, -1, -1, 1);
            Recipe.FindRecipes();
            success = true;
            return obj;
        }