execute if block ~ ~ ~ minecraft:dispenser[facing=up] run setblock ~ ~ ~ dispenser[facing=north]
execute if block ~ ~ ~ minecraft:dispenser[facing=down] run setblock ~ ~ ~ dispenser[facing=north]

execute if block ~ ~ ~ minecraft:dispenser[facing=north] run summon item_display ~ ~0.5 ~ {Rotation:[180F,0F],Tags:["vb.custom_block.trial_gate","vb.custom_block"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[1.001f,1.001f,1.001f]},item:{id:"minecraft:paper",count:1,components:{"minecraft:item_model":"vb:gate_key","minecraft:item_model":"vb:custom_block/trial_gate"}},view_range:4.0f}
execute if block ~ ~ ~ minecraft:dispenser[facing=north] run setblock ~ ~ ~ minecraft:vault[facing=north]{config:{key_item:{id:"minecraft:poisonous_potato",components:{"minecraft:item_model":"vb:gate_key","minecraft:custom_data":{"vb.item":1b,"vb.item.gate_key":1b},"minecraft:item_name":{translate:"vb.custom_item.gate_key"},"!minecraft:consumable":{},"!minecraft:food":{}}}}}
execute if block ~ ~ ~ minecraft:dispenser[facing=south] run summon item_display ~ ~0.5 ~ {Rotation:[0F,0F],Tags:["vb.custom_block.trial_gate","vb.custom_block"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[1.001f,1.001f,1.001f]},item:{id:"minecraft:paper",count:1,components:{"minecraft:item_model":"vb:gate_key","minecraft:item_model":"vb:custom_block/trial_gate"}},view_range:4.0f}
execute if block ~ ~ ~ minecraft:dispenser[facing=south] run setblock ~ ~ ~ minecraft:vault[facing=south]{config:{key_item:{id:"minecraft:poisonous_potato",components:{"minecraft:item_model":"vb:gate_key","minecraft:custom_data":{"vb.item":1b,"vb.item.gate_key":1b},"minecraft:item_name":{translate:"vb.custom_item.gate_key"},"!minecraft:consumable":{},"!minecraft:food":{}}}}}
execute if block ~ ~ ~ minecraft:dispenser[facing=east] run summon item_display ~ ~0.5 ~ {Rotation:[-90F,0F],Tags:["vb.custom_block.trial_gate","vb.custom_block"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[1.001f,1.001f,1.001f]},item:{id:"minecraft:paper",count:1,components:{"minecraft:item_model":"vb:gate_key","minecraft:item_model":"vb:custom_block/trial_gate"}},view_range:4.0f}
execute if block ~ ~ ~ minecraft:dispenser[facing=east] run setblock ~ ~ ~ minecraft:vault[facing=east]{config:{key_item:{id:"minecraft:poisonous_potato",components:{"minecraft:item_model":"vb:gate_key","minecraft:custom_data":{"vb.item":1b,"vb.item.gate_key":1b},"minecraft:item_name":{translate:"vb.custom_item.gate_key"},"!minecraft:consumable":{},"!minecraft:food":{}}}}}
execute if block ~ ~ ~ minecraft:dispenser[facing=west] run summon item_display ~ ~0.5 ~ {Rotation:[90F,0F],Tags:["vb.custom_block.trial_gate","vb.custom_block"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[1.001f,1.001f,1.001f]},item:{id:"minecraft:paper",count:1,components:{"minecraft:item_model":"vb:gate_key","minecraft:item_model":"vb:custom_block/trial_gate"}},view_range:4.0f}
execute if block ~ ~ ~ minecraft:dispenser[facing=west] run setblock ~ ~ ~ minecraft:vault[facing=west]{config:{key_item:{id:"minecraft:poisonous_potato",components:{"minecraft:item_model":"vb:gate_key","minecraft:custom_data":{"vb.item":1b,"vb.item.gate_key":1b},"minecraft:item_name":{translate:"vb.custom_item.gate_key"},"!minecraft:consumable":{},"!minecraft:food":{}}}}}

stopsound @a[distance=..17] block minecraft:block.stone.place