////

        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);
        }
        ////////////////

        public static void ApplyAllImplantsToChest(Chest chest)
        {
            var mymod  = ChestImplantsMod.Instance;
            var config = ChestImplantsConfig.Instance;

            // Get chest tile and name
            Tile   chestTile = Main.tile[chest.x, chest.y];
            string chestName;

            if (!TileFrameHelpers.VanillaChestTypeNamesByFrame.TryGetValue(chestTile.frameX / 36, out chestName))
            {
                throw new ModHelpersException("Could not find chest frame");
            }
//LogHelpers.Log("chest "+i+" pos:"+mychest.x+","+mychest.y+", frame:"+(mytile.frameX/36)+", wall:"+mytile.wall+" "+(mychest.item[0]!=null?mychest.item[0].Name:"..."));

            // Apply random implants
            foreach (ChestImplanterSetDefinition setDef in config.GetRandomImplanterSets())
            {
                ChestImplanter.ApplyRandomImplantsSetToChest(chest, chestName, setDef);
            }

            string propName         = nameof(ChestImplantsConfig.AllFromSetChestImplanterDefinitions);
            var    chestImplantDefs = config.Get <ChestImplanterSetDefinition>(propName);

            // Apply guaranteed implants
            foreach (Ref <ChestImplanterDefinition> implantDef in chestImplantDefs.Value)
            {
                ChestImplanter.ApplyImplantToChest(chest, implantDef.Value, chestName);
            }

            foreach ((string name, CustomChestImplanter customStuffer) in mymod.CustomImplanter)
            {
                if (ChestImplantsConfig.Instance.DebugModeInfo)
                {
                    LogHelpers.Log(
                        "ApplyAllImplantsToChest CUSTOM "
                        + "'" + chest.GetHashCode() + " " + chestName + "'"
                        + "- " + name + " at " + chest.x + "," + chest.y
                        );
                }

                customStuffer.Invoke(chestName, chest);
            }
        }