
# -> Drop items if possible
execute on passengers \
    if entity @s[type=item_display,tag=OverlyRealistic.Block.Basket_BasketItem] \
    at @s \
    align xyz run \
        function overly_realistic:general/custom_blocks/basket/basket_drop_items

# -> Remove barrier
fill ~ ~1 ~ ~ ~1 ~ air replace barrier

# -> Sound
playsound block.wood.break block @a ~ ~1 ~ 1 1
playsound block.wood.break block @a ~ ~1 ~ 1 1
playsound entity.zombie.break_wooden_door block @a ~ ~1 ~ 0.2 1.5

# -> Particles
particle block{block_state:"composter"} ~ ~1 ~ 0.3 0.3 0.3 1 40 normal @a
particle block{block_state:"mud_bricks"} ~ ~1 ~ 0.3 0.1 0.3 1 10 normal @a

# -> Drop item
execute unless entity @p[tag=OverlyRealistic.Player.BrokeCustomBlock,gamemode=creative,distance=..64] run \
    loot spawn ~ ~1 ~ loot overly_realistic:blocks/basket

# -> Remove displays
execute on passengers run \
    kill @s

# -> Remove marker
kill @s
