
# -> 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:raw_gold"}]

# -> 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.stone.break block @a ~ ~ ~ 0.5 1
playsound block.stone.hit block @a ~ ~ ~ 0.45 2

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

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

# -> Advancement
execute on target run \
    advancement grant @s only overly_realistic:advancements/iron_age/golden_days

# -> Send tip if possible
execute if score #or.setting.tips OverlyRealistic.Settings.ArbitrarySetting matches 1 \
    on target \
    unless score @s OverlyRealistic.Player.Tips.HasReceivedTip_GrindHighQualOre matches 1 run \
        function overly_realistic:players/tips/send_tip_high_qual_ore

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