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

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

# -> Sound
playsound block.wood.place block @a ~ ~ ~ 0.45 1.6

# -> Place block
summon interaction ~ ~-0.5 ~ {Tags:["OverlyRealistic.Block.ShipSection","OverlyRealistic.Block.IsFullBlock","OverlyRealistic.Block.IsCustomBlock"],response:1b,height:0.1f,width:3.0f,data:{or_custom_block_id:"ship_section",or_is_custom_block:1b},Passengers:[{id:"item_display",item:{id:"dirt",components:{item_model:"overlyrealistic:blocks/ship_section",custom_model_data:{floats:[0,0,0,0]}}},transformation:{left_rotation:[0.0f,0.0f,0.0f,1.0f],right_rotation:[0.0f,0.0f,0.0f,1.0f],scale:[1.0f,1.0f,1.0f],translation:[0.0f,0.4f,0.0f]}},{id:"text_display",alignment: "center", background: 0, billboard: "vertical", default_background: 0b, line_width: 200, see_through: 0b, shadow: 0b, text: [{text: "REQUIRES:\n", color: "white"},{atlas: "items", sprite: "overlyrealistic:item/iron_nail", color: "white"},{text: " 0/4 Iron Nails", color: "white"}], text_opacity: -110b, transformation: {left_rotation: [0.0f, 0.0f, 0.0f, 1.0f], right_rotation: [0.0f, 0.0f, 0.0f, 1.0f], scale: [1.0f, 1.0f, 1.0f], translation: [0.0f, 0.6f, 0.0f]}, view_range: 0.04694836f}]}

# -> Remove marker
kill @s
