# block:custom/cursed_head/place
# called by: block:custom/cursed_head/scan

## Sound
playsound block.stone.place block @a ~ ~ ~ 1 .8

## Block
data modify block ~ ~ ~ components."minecraft:custom_data".magical_addons.generated set value 1b

### type: wall
execute if data storage magical_addons:temp {data:{block:{hit_normal:{x:0,y:0,z:-1}}}} positioned ~ ~.25 ~.25 summon item_display run return run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"north",break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[0f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_wall,maddons.block.face_north]}
execute if data storage magical_addons:temp {data:{block:{hit_normal:{x:0,y:0,z:1}}}} positioned ~ ~.25 ~-.25 summon item_display run return run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"south",break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[180f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_wall,maddons.block.face_south]}
execute if data storage magical_addons:temp {data:{block:{hit_normal:{x:-1,y:0,z:0}}}} positioned ~.25 ~.25 ~ summon item_display run return run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"west",break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[-90f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_wall,maddons.block.face_west]}
execute if data storage magical_addons:temp {data:{block:{hit_normal:{x:1,y:0,z:0}}}} positioned ~-.25 ~.25 ~ summon item_display run return run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"east",break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[90f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_wall,maddons.block.face_east]}

### type: ground
execute store result score @s maddons.rotation run data get entity @s Rotation[0] 10
execute if score @s maddons.rotation matches -1686..-1462 summon item_display run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"up",rotation:9,break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[202.5f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_ground,maddons.block.rotation_9]}
execute if score @s maddons.rotation matches -1461..-1238 summon item_display run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"up",rotation:10,break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[225f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_ground,maddons.block.rotation_10]}
execute if score @s maddons.rotation matches -1237..-1014 summon item_display run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"up",rotation:11,break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[247.5f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_ground,maddons.block.rotation_11]}
execute if score @s maddons.rotation matches -1013..-790 summon item_display run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"up",rotation:12,break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[270f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_ground,maddons.block.rotation_12]}
execute if score @s maddons.rotation matches -789..-566 summon item_display run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"up",rotation:13,break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[292.5f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_ground,maddons.block.rotation_13]}
execute if score @s maddons.rotation matches -565..-342 summon item_display run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"up",rotation:14,break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[315f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_ground,maddons.block.rotation_14]}
execute if score @s maddons.rotation matches -341..-113 summon item_display run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"up",rotation:15,break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[337.5f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_ground,maddons.block.rotation_15]}
execute if score @s maddons.rotation matches -112..112 summon item_display run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"up",rotation:0,break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[0f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_ground,maddons.block.rotation_0]}
execute if score @s maddons.rotation matches 113..337 summon item_display run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"up",rotation:1,break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[22.5f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_ground,maddons.block.rotation_1]}
execute if score @s maddons.rotation matches 338..562 summon item_display run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"up",rotation:2,break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[45f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_ground,maddons.block.rotation_2]}
execute if score @s maddons.rotation matches 563..787 summon item_display run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"up",rotation:3,break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[67.5f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_ground,maddons.block.rotation_3]}
execute if score @s maddons.rotation matches 788..1012 summon item_display run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"up",rotation:4,break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[90f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_ground,maddons.block.rotation_4]}
execute if score @s maddons.rotation matches 1013..1237 summon item_display run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"up",rotation:5,break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[112.5f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_ground,maddons.block.rotation_5]}
execute if score @s maddons.rotation matches 1238..1462 summon item_display run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"up",rotation:6,break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[135f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_ground,maddons.block.rotation_6]}
execute if score @s maddons.rotation matches 1463..1687 summon item_display run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"up",rotation:7,break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[157.5f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_ground,maddons.block.rotation_7]}
execute if score @s maddons.rotation matches 1688..1800 summon item_display run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"up",rotation:8,break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[180f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_ground,maddons.block.rotation_8]}
execute if score @s maddons.rotation matches -1799..-1687 summon item_display run data merge entity @s {data:{magical_addons:{id:"cursed_head",face:"up",rotation:8,break_cmd:"execute unless block ~ ~ ~ spawner{components:{\"minecraft:custom_data\":{magical_addons:{id:cursed_head}}}} run function magical_addons:block/custom/cursed_head/break"}},transformation:{scale:[1.01,1.01,1.01]},Rotation:[180f,0f],item:{id:"player_head",components:{"minecraft:item_model":"magical_addons:cursed_head"}},view_range:64,Tags:[maddons.block,maddons.cursed_head,maddons.invul,maddons.block.type_ground,maddons.block.rotation_8]}