
# -> Decrease boil time
execute if score @s OverlyRealistic.World.BasketBoilTime matches 1.. run \
    scoreboard players remove @s OverlyRealistic.World.BasketBoilTime 1

# -> Sweet berry baseplate operations
execute if entity @s[tag=OverlyRealistic.Block.Basket_Status_HasSweetBerryBase] run \
    function overly_realistic:general/custom_blocks/basket/looping_operations/sweet_berry_operations/looping_operate_2t

# -> If block below is not a lit campfire then return
execute unless block ~ ~-1 ~ #campfires[lit=true] run \
    return fail

# -> If basket is not waterlogged then return
execute unless block ~ ~ ~ barrier[waterlogged=true] run \
    return fail

# -> Add to boil time
execute unless score @s OverlyRealistic.World.BasketBoilTime matches 500.. run \
    scoreboard players add @s OverlyRealistic.World.BasketBoilTime 2

# -> If boil time is not over 100 then return
execute unless score @s OverlyRealistic.World.BasketBoilTime matches 100.. run \
    return fail

# -> Advancement
advancement grant @p[distance=..3,limit=5] only overly_realistic:advancements/stone_age/boiling_point

# -> Bubbles
playsound block.bubble_column.bubble_pop block @a ~ ~0.6 ~ 1 1
particle minecraft:bubble ~ ~0.6 ~ 0.125 0 0.125 0.001 1 normal @a
particle bubble_pop ~ ~0.6 ~ 0.125 0 0.125 0.001 2 normal @a

# -> If boil time is not maxxed then return
execute unless score @s OverlyRealistic.World.BasketBoilTime matches 500.. run \
    return fail

# -> Display extra particles
particle splash ~ ~0.8 ~ 0.125 0 0.125 0.001 10 normal @a

# -> Extra sounds
playsound block.bubble_column.bubble_pop block @a ~ ~0.6 ~ 1 1
playsound block.bubble_column.bubble_pop block @a ~ ~0.6 ~ 1 1

# -> Fermented berries operate
execute if entity @s[tag=OverlyRealistic.Block.Basket_Status_HasFermentedSweetBerryBase,tag=!OverlyRealistic.Block.Basket_Status_HasFermentedBoiledSweetBerryBase] run \
    function overly_realistic:general/custom_blocks/basket/looping_operations/sweet_berry_operations/boil_fermented_berry_base

# -> Advancement (boiled fermented berries)
execute if entity @s[tag=OverlyRealistic.Block.Basket_Status_HasFermentedBoiledSweetBerryBase] run \
    advancement grant @p[distance=..3,limit=10] only overly_realistic:advancements/stone_age/bottle_ready
