#tellraw @s "It looks like you are upgrading from 1.20.4 or previous. Attempting a patch! (or something really weird happened)"

execute if entity @s[nbt={Inventory:[{Slot:0b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s hotbar.0 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:1b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s hotbar.1 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:2b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s hotbar.2 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:3b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s hotbar.3 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:4b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s hotbar.4 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:5b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s hotbar.5 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:6b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s hotbar.6 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:7b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s hotbar.7 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:8b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s hotbar.8 thepa:version_update

execute if entity @s[nbt={Inventory:[{Slot:9b ,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.0 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:10b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.1 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:11b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.2 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:12b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.3 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:13b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.4 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:14b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.5 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:15b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.6 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:16b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.7 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:17b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.8 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:18b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.9 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:19b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.10 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:20b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.11 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:21b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.12 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:22b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.13 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:23b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.14 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:24b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.15 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:25b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.16 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:26b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.17 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:27b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.18 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:28b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.19 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:29b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.20 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:30b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.21 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:31b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.22 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:32b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.23 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:33b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.24 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:34b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.25 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:35b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}]}] run item modify entity @s inventory.26 thepa:version_update
execute if entity @s[nbt={equipment:{offhand:{components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:crossbow"}}}] run item modify entity @s weapon.offhand thepa:version_update


execute if entity @s[nbt={Inventory:[{Slot:0b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s hotbar.0 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:1b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s hotbar.1 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:2b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s hotbar.2 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:3b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s hotbar.3 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:4b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s hotbar.4 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:5b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s hotbar.5 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:6b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s hotbar.6 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:7b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s hotbar.7 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:8b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s hotbar.8 thepa:version_update

execute if entity @s[nbt={Inventory:[{Slot:9b ,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.0 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:10b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.1 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:11b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.2 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:12b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.3 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:13b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.4 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:14b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.5 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:15b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.6 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:16b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.7 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:17b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.8 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:18b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.9 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:19b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.10 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:20b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.11 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:21b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.12 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:22b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.13 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:23b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.14 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:24b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.15 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:25b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.16 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:26b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.17 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:27b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.18 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:28b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.19 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:29b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.20 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:30b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.21 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:31b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.22 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:32b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.23 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:33b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.24 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:34b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.25 thepa:version_update
execute if entity @s[nbt={Inventory:[{Slot:35b,components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}]}] run item modify entity @s inventory.26 thepa:version_update
execute if entity @s[nbt={equipment:{offhand:{components:{"minecraft:custom_data":{gz_data:{}}},id:"minecraft:bow"}}}] run item modify entity @s weapon.offhand thepa:version_update

tag @s remove recipeggiven
tellraw @s "Done!"