execute on passengers if items entity @s container.0 leather_horse_armor on vehicle on target if items entity @s weapon.mainhand * run return run title @s actionbar {"translate":"scientist.emptyhand","color":"red"}
execute on passengers unless items entity @s container.0 leather_horse_armor on vehicle on target unless items entity @s weapon.mainhand minecraft:leather_horse_armor[minecraft:custom_model_data=1] run return run title @s actionbar {"translate":"scientist.selectcapsule","color":"red"}
execute at @s run particle minecraft:wax_on ~ ~0.5 ~ 0.3 0.1 0.1 0.3 10
execute on passengers run tag @s add scientist.insertitem
execute at @s run playsound minecraft:block.copper_bulb.place block @a ~ ~ ~ 1 1
execute on target run data modify storage ws:scientist inserted_item set from entity @s SelectedItem
execute on target run item replace entity @s weapon.mainhand from entity @n[tag=scientist.insertitem,type=item_display] container.0
execute on passengers if items entity @s container.0 leather_horse_armor run item replace entity @s container.0 with air
data modify entity @n[tag=scientist.insertitem] item set from storage ws:scientist inserted_item
tag @e[tag=scientist.insertitem] remove scientist.insertitem
data remove storage ws:scientist inserted_item