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

# -> 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/bellow/bellow_break_from_place

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

# -> Rotate perm marker
execute rotated as @p[tag=OverlyRealistic.Player.PlacedCustomBlock] run \
    rotate 00000001-0000-002a-0000-00010000002a ~ ~

# -> Get rotation
execute store result score #or.bellow_rotation OverlyRealistic.General.ArbitraryData run \
    data get entity 00000001-0000-002a-0000-00010000002a Rotation[0]

# -> Set rotation data
execute unless block ~ ~ ~ #air \
    if block ~ ~1 ~ #air \
    positioned ~ ~1 ~ run \
        function overly_realistic:general/custom_blocks/bellow/place_bellow_from_rotation
execute if block ~ ~ ~ #air run \
    function overly_realistic:general/custom_blocks/bellow/place_bellow_from_rotation

# -> Remove marker
kill @s
