
# -> If block is not in air then return and break
execute unless block ~ ~ ~ #air \
    unless block ~ ~ ~ #campfires \
    unless block ~ ~ ~ #slabs run \
        return run \
            function overly_realistic:general/custom_blocks/heated_wrought_iron/heated_wrought_iron_break

# -> If block is inside another custom block then return and break
execute align xyz \
    if entity @n[type=interaction,tag=OverlyRealistic.Block.IsCustomBlock,tag=!OverlyRealistic.Block.IsFullBlock,dx=0,dy=0,dz=0] run \
        return run \
            function overly_realistic:general/custom_blocks/heated_wrought_iron/heated_wrought_iron_break

# -> Sound
playsound block.stone.place block @a ~ ~ ~ 0.45 1

# -> Place display
summon interaction ~ ~ ~ {response:1b,Tags:["OverlyRealistic.Block.HeatedWroughtIron","OverlyRealistic.Block.IsCustomBlock","OverlyRealistic.Block.HeatedWroughtIron_TempWroughtIron"],width:0.6f,height:0.3f,data:{interaction_call:"overly_realistic:general/custom_blocks/heated_wrought_iron/heated_wrought_iron_interaction",break_call:"overly_realistic:general/custom_blocks/heated_wrought_iron/heated_wrought_iron_break"},Passengers:[{id:"item_display",Tags:["OverlyRealistic.Block.HeatedWroughtIron"],item: {count: 1, id: "minecraft:raw_iron", components:{item_model:"overlyrealistic:blocks/heated_wrought_iron_placed"}}, transformation: {left_rotation: [-0.7071068f, 0.0f, 0.0f, 0.7071068f], right_rotation: [0.0f, 0.0f, 0.0f, 1.0f], scale: [0.56250036f, 0.5624999f, 0.5624999f], translation: [0.0f, -0.29f, 0.0f]}},{id:"text_display", Tags:["OverlyRealistic.Block.HeatedWroughtIron_TextBackground"], alignment: "center", background: 0, billboard: "vertical", default_background: 0b, line_width: 200, see_through: 0b, shadow: 0b, text: {atlas: "minecraft:gui", sprite: "minecraft:advancements/challenge_frame_unobtained"}, text_opacity: -107b, transformation: {left_rotation: [0.0f, 0.0f, 0.0f, 1.0f], right_rotation: [0.0f, 0.0f, 0.0f, 1.0f], scale: [4.0651855f, 4.004658f, 12.17603f], translation: [-0.099f, 0.1f, 0.0f]}, view_range: 0.05f},{id:"text_display", Tags:[OverlyRealistic.Block.HeatedWroughtIron_Text], alignment: "center", background: 0, billboard: "vertical", default_background: 0b, line_width: 200, see_through: 0b, shadow: 0b, text: [{text:"",extra:[{text: "...\n", color: "black"},{text: "...\n", color: "black"},{text: "...\n", color: "black"},{text: "...", color: "black"}]}], text_opacity: 126b, transformation: {left_rotation: [0.0f, 0.0f, 0.0f, 1.0f], right_rotation: [0.0f, 0.0f, 0.0f, 1.0f], scale: [0.43758005f, 0.43758005f, 0.43758005f], translation: [0.01f, 0.51f, 0.01f]},view_range: 0.05f}]}

# -> Advancement
advancement grant @p[tag=OverlyRealistic.Player.PlacedCustomBlock,tag=OverlyRealistic.Player.PlacedCustomBlock,distance=..64] only overly_realistic:advancements/iron_age/the_start_of_a_new_forge

# -> Edit wrought iron
execute align xyz \
    as @n[type=interaction,tag=OverlyRealistic.Block.HeatedWroughtIron_TempWroughtIron,dx=0,dy=0,dz=0] run \
        function overly_realistic:general/custom_blocks/heated_wrought_iron/heated_wrought_iron_edit
