
# -> If block is not in air then return and break
execute unless block ~ ~ ~ #air run \
    return run \
        function overly_realistic:general/custom_blocks/basket/basket_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/basket/basket_break

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

# -> Place display
#summon minecraft:block_display ~ ~ ~ {Tags:["OverlyRealistic.Block.Basket"],Passengers: [{block_state: {Name: "minecraft:mud_brick_slab", Properties: {type: "bottom", waterlogged: "false"}}, id: "minecraft:block_display", transformation: {left_rotation: [0.0f, 0.0f, 0.0f, 1.0f], right_rotation: [0.0f, 0.0f, 0.0f, 1.0f], scale: [1.0006222f, 1.0006222f, 1.0006222f], translation: [-0.5003111f, -0.5003111f, -0.5003111f]}}], block_state: {Name: "minecraft:composter", Properties: {level: "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.5f, -0.5f, -0.5f]}}

# -> Place block
setblock ~ ~ ~ barrier

# -> Place interaction
summon interaction ~ ~-0.501 ~ {response:1b,Tags:["OverlyRealistic.Block.Basket","OverlyRealistic.Block.Basket_Status_Empty","OverlyRealistic.Block.IsCustomBlock","OverlyRealistic.Block.IsFullBlock"],width:1.001f,height:1.002f,data:{BasketItems:[],interaction_call:"overly_realistic:general/custom_blocks/basket/basket_interaction",break_call:"overly_realistic:general/custom_blocks/basket/basket_broken_by_player"},Passengers:[{id:"item_display",Tags:["OverlyRealistic.Block.Basket"],item: {components: {"minecraft:item_model": "overlyrealistic:blocks/basket"}, count: 1, id: "minecraft:paper"}, 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.5f, 0.0f]}}]}

# -> Remove marker
kill @s
