execute unless entity @s[gamemode=creative] run item modify entity @s weapon.mainhand pctf:remove1
execute anchored eyes rotated ~ 0 positioned ^ ^-1 ^2 run summon item_display ~ ~ ~ {interpolation_duration:1,teleport_duration:2,Tags:["lucky_block","new","default","ultra_rare"],CustomName:{"color":"yellow","text":"Ultra Rare Lucky Block"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[0f,0f,0f]},item:{id:"minecraft:player_head",count:1,components:{"minecraft:profile":{id:[I;85872623,-726840808,-1563458316,207241186],properties:[{name:"textures",value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzEyMGQ1NzY1ODUxZDhlODlkYzI5YTU2YTYxY2FhYmVhYzdkMjZkOWYzNjQ3ZjQxZmI3NzE1ZWI3OGU0MmU3ZiJ9fX0="}]}}}}

tag @s add lucky_block_temp

data merge entity @n[type=item_display,tag=new] {view_range:0.5f,Glowing:1b,glow_color_override:0,start_interpolation:0,interpolation_duration:10,transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0.0f,0.75f,0.0f],scale:[1.5f,1.5f,1.5f]}}

execute as @n[type=item_display,tag=new] run scoreboard players operation @s ctf_ID = @n[tag=lucky_block_temp] ctf_ID
execute as @n[type=item_display,tag=new] run scoreboard players operation @s real_ID = @n[tag=lucky_block_temp] real_ID

execute store result score #random temp run random value 1..2
execute if score #random temp matches 1 run tag @n[type=item_display,tag=new] add right
execute if score #random temp matches 2 run tag @n[type=item_display,tag=new] add left

execute as @n[type=item_display,tag=new] run tag @s remove new

tag @s remove lucky_block_temp

playsound minecraft:block.metal.place block @a ~ ~ ~ 2 1.25
playsound minecraft:entity.wither.spawn player @a ~ ~ ~ 2 2

scoreboard players set @s item_cooldown 10