execute store result score #powerup temp run random value 1..15

# coin
execute if score #powerup temp matches 1..3 run summon item_display ~ ~ ~ {interpolation_duration:1,teleport_duration:1,Tags:["end_delete","powerup","coin","new"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[1.5f,1.5f,1.5f]},item:{id:"minecraft:player_head",count:1,components:{"minecraft:profile":{id:[I;1319857983,1743995955,-1183922674,-1583537226],properties:[{name:"textures",value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjMxMWU4NDIyNDk3NDUxMTMzMzM4NzhmZDVhOGQ4ZWIyMjgwYmNiYWI3Njg5ZTQ3M2YxNjY5NjIzYTExYzk5NyJ9fX0="}]}}}}

# gem
execute if score #powerup temp matches 4..5 run summon item_display ~ ~ ~ {interpolation_duration:1,teleport_duration:1,Tags:["end_delete","powerup","gem","new"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[1.5f,1.5f,1.5f]},item:{id:"minecraft:player_head",count:1,components:{"minecraft:profile":{id:[I;-89195397,-1690090411,-1434133258,1951005603],properties:[{name:"textures",value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzQwNjNiYTViMTZiNzAzMGEyMGNlNmYwZWE5NmRjZDI0YjA2NDgzNmY1NzA0NTZjZGJmYzllODYxYTc1ODVhNSJ9fX0="}]}}}}

# strength
execute if score #powerup temp matches 6..7 run summon item_display ~ ~ ~ {interpolation_duration:1,teleport_duration:1,Tags:["end_delete","powerup","strength","new"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[1.5f,1.5f,1.5f]},item:{id:"minecraft:player_head",count:1,components:{"minecraft:profile":{id:[I;-1636043541,617235727,-2105977209,-1949254728],properties:[{name:"textures",value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGEwMGM1M2NmNTdjYWNjN2Y1ZThlM2ZlODRiMmY1ZGIxMjJjZDc2ZmNlZDc4MGE5NTNiOTk2MzlmYjMxOTg4MiJ9fX0="}]}}}}

# absorpsion
execute if score #powerup temp matches 8..9 run summon item_display ~ ~ ~ {interpolation_duration:1,teleport_duration:1,Tags:["end_delete","powerup","absorb","new"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[1.5f,1.5f,1.5f]},item:{id:"minecraft:player_head",count:1,components:{"minecraft:profile":{id:[I;1690828648,-483504637,-1688796541,877159764],properties:[{name:"textures",value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjFmOTA5Y2MxYzMyZGEzYjExNjAzOTQ0ZDRmNzMxZDYzYmFhOWFkZTFlMTIxMWRkZjlmMDE1NTA5MWM1Yzk0YiJ9fX0="}]}}}}

# heal
execute if score #powerup temp matches 10..11 run summon item_display ~ ~ ~ {interpolation_duration:1,teleport_duration:1,Tags:["end_delete","powerup","heal","new"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[1.5f,1.5f,1.5f]},item:{id:"minecraft:player_head",count:1,components:{"minecraft:profile":{id:[I;-2137712209,651643977,-1551608667,341963455],properties:[{name:"textures",value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNjJhYzk5MjZkY2ZiNzY0MWExNjIxMjY5MTEyNmUwM2Q5NWQ2NDZhZDM0NWI3NWExOTIwNjFhMWE5MzlkODkwMiJ9fX0="}]}}}}

# random upgrade
execute if score #powerup temp matches 12 run summon item_display ~ ~ ~ {interpolation_duration:1,teleport_duration:1,Tags:["end_delete","powerup","upgrade","new"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[1.5f,1.5f,1.5f]},item:{id:"minecraft:player_head",count:1,components:{"minecraft:profile":{id:[I;1372328206,1919240605,-1361580616,1798622527],properties:[{name:"textures",value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYWNiOGU3MjBhMDI3MjRiN2MzNDNmZGQ0NDc5MGZhYjRjMGQxZjE2YWFmODExMzgxOTJjNzBmODEyY2U0ZjYyMiJ9fX0="}]}}}}

# jump
execute if score #powerup temp matches 13..14 run summon item_display ~ ~ ~ {interpolation_duration:1,teleport_duration:1,Tags:["end_delete","powerup","jump","new"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[1.5f,1.5f,1.5f]},item:{id:"minecraft:player_head",count:1,components:{"minecraft:profile":{id:[I;-814266723,1847609363,-1901377764,-1127457969],properties:[{name:"textures",value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNmQ0ZWFkMWVmZTBjZjc3NjAxNWJmZDJjMjM2ZGRmN2MwZDMzMDllYjU5OWIzOWQ2YWMxMGQ3ZmExMWEzZTA3NSJ9fX0="}]}}}}

# bridge snowball
execute if score #powerup temp matches 15 run summon item_display ~ ~ ~ {interpolation_duration:1,teleport_duration:1,Tags:["end_delete","powerup","bridge_snowball","new"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[1.5f,1.5f,1.5f]},item:{id:"minecraft:player_head",count:1,components:{"minecraft:profile":{id:[I;-2016161354,1281444306,-2113520517,-1859305578],properties:[{name:"textures",value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTExNWM3OTY4ZWMzNzcxZWU5ZmY2YWU2YmNhMmQ1YmEzOTYyYWE3MjdhNGZhOGQzNzYwOGU0YzliZjE1MTJiYiJ9fX0="}]}}}}

fill ~1 ~1 ~1 ~-1 ~-1 ~-1 minecraft:air replace #pctf:can_break

scoreboard players operation @n[tag=new] map_id = @s map_id
data merge entity @n[tag=new] {view_range:0.7f}
tag @n[tag=new] remove new