Item Modifier 1.20.5

I was making a magic datapack, and when I decided to update the pack to 1.20.5 I was unable to figure out how to convert my original Item Modifier code to 1.20.5, I had previously made it so that if a player shifted and right clicked their wand at the same time it would switch to the next spell and cycle 1 - 9 but because I do not understand how to check the value of a custom data in the new Item Modifiers, this is as far as I got. 1.20.2 version

  {
    "function": "minecraft:set_nbt",
    "tag": "{spell:2b}",
    "conditions": [
      {
        "condition": "minecraft:entity_properties",
        "entity": "this",
        "predicate": {
          "equipment": {
            "mainhand": {
              "items": [
                "minecraft:warped_fungus_on_a_stick"
              ],
              "nbt": "{spell:1b}"
            }
          }
        }
      }
    ]
  }

1.20.5 version

  {
    "function": "minecraft:copy_custom_data",
    "source": "this",
    "ops": [
      {
        "source": "spells:1b",
        "target": "spells:2b",
        "op": "replace"
      }
    ],
    "conditions": [
      {
        "condition": "minecraft:match_tool",
        "predicate": {
          "components": {
            "minecraft:custom_data": {}
          }
        }
      }
    ]
  },

The rest of the sections are about the same.

Continue to help post