execute at @s positioned ~ ~.3 ~ run setblock ~ ~ ~ minecraft:trapped_chest{CustomName:'{"text":"Diamond Anvil","color":"dark_aqua","italic":false}'}
execute at @s run playsound minecraft:block.anvil.place voice @a[distance=..8]
execute at @s positioned ~ ~.3 ~ align x align z align y positioned ~ ~ ~ run summon minecraft:armor_stand ~0.5 ~ ~0.5 {Pose:{Head:[0f,90f,0f]},Invisible:1,DisabledSlots:4144959,Marker:1b,Tags:["nl_Anvil"]}

execute at @s as @e[tag=nl_Anvil,limit=1,sort=nearest] if entity @p[y_rotation=45..135] run data merge entity @s {Pose:{Head:[0f,00f,0f]}}
execute at @s as @e[tag=nl_Anvil,limit=1,sort=nearest] if entity @p[y_rotation=136..225] run data merge entity @s {Pose:{Head:[0f,90f,0f]}}
execute at @s as @e[tag=nl_Anvil,limit=1,sort=nearest] if entity @p[y_rotation=226..315] run data merge entity @s {Pose:{Head:[0f,00f,0f]}}

execute at @s as @e[tag=nl_Anvil,limit=1,sort=nearest] if entity @p[y_rotation=316..360] run data merge entity @s {Pose:{Head:[0f,90f,0f]}}
execute at @s as @e[tag=nl_Anvil,limit=1,sort=nearest] if entity @p[y_rotation=0..45] run data merge entity @s {Pose:{Head:[0f,90f,0f]}}

execute at @s as @e[tag=nl_Anvil,limit=1,sort=nearest] run data merge entity @s {ArmorItems:[{},{},{},{id:"minecraft:firework_rocket",Count:1b,tag:{CustomModelData:1412004}}]}

kill @s


#            90
#            |
#     45     |     135
#            |
#            |
#   0-------- ---------180
#            |
#    315     |     225
#            |
#           270