execute as @e[tag=spawncapture] at @s run function survivalplus:tools/capturebag/place with entity @s data
execute if entity @s[gamemode=!creative] run loot give @s loot survivalplus:ngtools/capturebag
execute if data entity @s[gamemode=creative] SelectedItem.components."minecraft:custom_data".captured run loot replace entity @s weapon.mainhand loot survivalplus:ngtools/capturebag
execute if data entity @s[gamemode=creative] equipment.offhand.components."minecraft:custom_data".captured unless data entity @p SelectedItem.components."minecraft:custom_data".capturedevice run loot replace entity @s weapon.offhand loot survivalplus:ngtools/capturebag
advancement revoke @s only survivalplus:tools/titan/uncapture