
# -> Get the amount of items needed in the input
execute store result score #or.mortar_item_needed_amount OverlyRealistic.General.ArbitraryData \
    if data storage overly_realistic:temp_values temp_mortar_items[{id:"minecraft:wheat"}]

# -> If the amount of items needed is incorrect then return
execute if score #or.mortar_item_needed_amount OverlyRealistic.General.ArbitraryData matches ..3 run \
    return fail

# -> Sound
playsound block.bamboo_sapling.break block @a ~ ~ ~ 0.2 2
playsound minecraft:block.sand.break block @a ~ ~ ~ 0.5 1
playsound minecraft:block.sand.break block @a ~ ~ ~ 0.5 1.5

# -> Particle
particle item{item:"stick"} ~ ~ ~ 0.1 0.1 0.1 0.1 8 normal @a

# -> Drop item
loot spawn ~ ~ ~ loot overly_realistic:items/mortar_pestle_interaction_items/wheat_flour

# -> Advancement
execute on target run \
    advancement grant @s only overly_realistic:advancements/mortar_uses/blooming_flour
#execute on target run \
    advancement grant @s only overly_realistic:advancements/stone_age/blooming_flour

# -> Remove items
function overly_realistic:general/custom_blocks/mortar/interactions/int_remove_all_items_no_drop
