
# -> Get planks amount
scoreboard players set #or.basket_item_planks_amount OverlyRealistic.General.ArbitraryData 0
execute on passengers \
    if entity @s[tag=OverlyRealistic.Block.PreparationPlate_Item] \
    if items entity @s contents #planks run \
        scoreboard players add #or.basket_item_planks_amount OverlyRealistic.General.ArbitraryData 1

# -> If planks < 6 then return
execute unless score #or.basket_item_planks_amount OverlyRealistic.General.ArbitraryData matches 6 run \
    return fail

# -> Drop basket
loot spawn ~ ~0.5 ~ loot overly_realistic:blocks/basket

# -> Sound
playsound block.leaf_litter.step block @a ~ ~ ~ 0.5 1

# -> Advancement
execute on target run \
    advancement grant @s only overly_realistic:advancements/stone_age/the_handyman
execute on target run \
    advancement grant @s only overly_realistic:advancements/basket_uses/basket_uses
execute on target run \
    advancement grant @s only overly_realistic:advancements/stone_age/not_a_cauldron

# -> Remove items & additionals
function overly_realistic:general/custom_blocks/preparation_plate/interactions/int_remove_all_items_no_drop
