////////////////

        public static void Implant(Chest chest, ChestImplanterItemDefinition info)
        {
            int addedAmount = ChestImplanter.GetImplantQuantity(info);

            if (addedAmount == 0)
            {
                return;
            }

            int itemType = info.ChestItem.Type;

            if (itemType == 0)
            {
                LogHelpers.Alert("Invalid item key " + info.ChestItem);
                return;
            }

            // Add or remove quantity of item, according to implanter spec
            if (addedAmount > 0)
            {
                ChestImplanter.PrependItemToChest(chest, itemType, addedAmount, info);
            }
            else if (addedAmount < 0)
            {
                ChestImplanter.ExtractItemFromChest(chest, itemType, -addedAmount);
            }
            else
            {
                throw new ModHelpersException("Invalid quantity.");
            }
        }
        private static void ApplyImplantToChest(Chest chest, ChestImplanterDefinition implantDef, string currentChestType)
        {
            Tile chestTile = Main.tile[chest.x, chest.y];

            // Check if chest type is recognized by the given implanter
            bool isMatched = false;

            foreach (Ref <string> checkChestType in implantDef.ChestTypes)
            {
                if (ChestImplanter.IsChestMatch(currentChestType, checkChestType.Value))
                {
                    isMatched = true;
                    break;
                }
            }

            // Guess not?
            if (!isMatched)
            {
                return;
            }

            // Implant each item (item-implanter willing)
            foreach (ChestImplanterItemDefinition itemImplantDef in implantDef.ItemDefinitions)
            {
                bool canImplant = ChestImplanter.CanChestAcceptImplantItem(chestTile, itemImplantDef);

                if (ChestImplantsConfig.Instance.DebugModeVerboseInfo)
                {
                    LogHelpers.Log(" ApplyImplantToChest "
                                   + chest.GetHashCode() + currentChestType
                                   + " - " + itemImplantDef.ToCustomString()
                                   + " - " + canImplant
                                   + " - " + ChestImplanter.GetImplantQuantity(itemImplantDef)
                                   );
                }

                if (canImplant)
                {
                    ChestImplanter.Implant(chest, itemImplantDef);
                }
            }
        }