////

        private static void ApplyRandomImplantsSetToChest(
            Chest chest,
            string currentChestType,
            ChestImplanterSetDefinition setDef)
        {
            ChestImplanterDefinition implantDef = ChestImplanter.GetRandomImplanterFromSet(setDef);

            if (implantDef == null)
            {
                return;
            }

            if (ChestImplantsConfig.Instance.DebugModeInfo)
            {
                LogHelpers.Log(
                    "ApplyConfiguredImplantsToChest RAND "
                    + "'" + chest.GetHashCode() + " " + currentChestType + "' at " + chest.x + "," + chest.y
                    //+ " - Set total: " + setDef.Value.Count + " - Items of set's pick: " + implantDef?.ItemDefinitions.Count
                    + " - " + string.Join(", ", implantDef?.ItemDefinitions.Select(
                                              itemDef => itemDef.ChestItem.ToString() + " (" + (int)(itemDef.ChancePerChest * 100f) + "%)"
                                              ))
                    );
            }

            ChestImplanter.ApplyImplantToChest(chest, implantDef, currentChestType);
        }
        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);
                }
            }
        }