execute if score @s gem_timer matches 1.. run scoreboard players remove @s gem_timer 1
execute if score @s gem_timer matches 1.. run return 0
scoreboard players add @s gems 1
playsound minecraft:block.end_portal_frame.fill player @s ~ ~ ~ 0.3 2
particle minecraft:happy_villager ~ ~1 ~ 1 1 1 0 1 normal @s
scoreboard players remove @s gems_to_add 1
scoreboard players set @s gem_timer 3