execute store result score #angle temp run random value 1..5

$execute if score #angle temp matches 1 run summon item ~ ~ ~ {PickupDelay:20,Glowing:1b,Age:5700,Motion:[0.$(x_dec),0.$(y_dec),0.$(z_dec)],Tags:["new","gem"],Item:{id:"minecraft:emerald",count:1,components:{"minecraft:item_name":{"color":"green","italic":false,"text":"Gem"},"minecraft:custom_data":{gem:1b},"minecraft:max_stack_size":1}}}
$execute if score #angle temp matches 2 run summon item ~ ~ ~ {PickupDelay:20,Glowing:1b,Age:5700,Motion:[-0.$(x_dec),0.$(y_dec),0.$(z_dec)],Tags:["new","gem"],Item:{id:"minecraft:emerald",count:1,components:{"minecraft:item_name":{"color":"green","italic":false,"text":"Gem"},"minecraft:custom_data":{gem:1b},"minecraft:max_stack_size":1}}}
$execute if score #angle temp matches 3 run summon item ~ ~ ~ {PickupDelay:20,Glowing:1b,Age:5700,Motion:[0.$(x_dec),0.$(y_dec),0.$(z_dec)],Tags:["new","gem"],Item:{id:"minecraft:emerald",count:1,components:{"minecraft:item_name":{"color":"green","italic":false,"text":"Gem"},"minecraft:custom_data":{gem:1b},"minecraft:max_stack_size":1}}}
$execute if score #angle temp matches 4 run summon item ~ ~ ~ {PickupDelay:20,Glowing:1b,Age:5700,Motion:[0.$(x_dec),0.$(y_dec),-0.$(z_dec)],Tags:["new","gem"],Item:{id:"minecraft:emerald",count:1,components:{"minecraft:item_name":{"color":"green","italic":false,"text":"Gem"},"minecraft:custom_data":{gem:1b},"minecraft:max_stack_size":1}}}
$execute if score #angle temp matches 5 run summon item ~ ~ ~ {PickupDelay:20,Glowing:1b,Age:5700,Motion:[-0.$(x_dec),0.$(y_dec),-0.$(z_dec)],Tags:["new","gem"],Item:{id:"minecraft:emerald",count:1,components:{"minecraft:item_name":{"color":"green","italic":false,"text":"Gem"},"minecraft:custom_data":{gem:1b},"minecraft:max_stack_size":1}}}

execute as @e[type=item,tag=new,tag=gem] run team join gem
tag @e[type=item,tag=new,tag=gem] remove new