
# -> If there is water filled then return
execute if entity @s[tag=!OverlyRealistic.Block.Basket_IsWaterLogged] run \
    return fail

# -> Untag basket
tag @s remove OverlyRealistic.Block.Basket_IsWaterLogged

# -> Sound
playsound item.bucket.fill block @a ~ ~ ~ 0.45 1

# -> Reset liquid type
scoreboard players set #or.basket_contents_liquid_type OverlyRealistic.General.ArbitraryData 0

# -> Get water type
execute on passengers \
    if entity @s[tag=OverlyRealistic.Block.Basket_IsWater] run \
        function overly_realistic:general/custom_blocks/basket/interactions/get_water/basket_get_water_type

# -> If boil time is at max then set value
execute if score @s OverlyRealistic.World.BasketBoilTime matches 500.. run \
    scoreboard players set #or.basket_contents_liquid_type OverlyRealistic.General.ArbitraryData 1

# -> Cache BasketItems
data modify storage overly_realistic:temp_values temp_basket_items set from entity @s data.BasketItems

# -> If there is a boiled fermented sweet berry base then set value
execute if entity @s[tag=OverlyRealistic.Block.Basket_Status_HasFermentedBoiledSweetBerryBase] run \
    scoreboard players set #or.basket_contents_liquid_type OverlyRealistic.General.ArbitraryData 2
execute if entity @s[tag=OverlyRealistic.Block.Basket_Status_HasFermentedBoiledSweetBerryBase] \
    if data storage overly_realistic:temp_values \
        {\
            temp_basket_items:\
                [\
                    {id:"minecraft:sugar"},{id:"minecraft:sugar"},{id:"minecraft:sugar"},\
                    {id:"minecraft:sugar"},{id:"minecraft:sugar"},{id:"minecraft:sugar"},\
                    {id:"minecraft:sugar"},{id:"minecraft:sugar"},{id:"minecraft:sugar"}\
                ]\
        } run \
            scoreboard players set #or.basket_contents_liquid_type OverlyRealistic.General.ArbitraryData 3

# -> Remove water
execute on passengers run \
    kill @s[tag=OverlyRealistic.Block.Basket_IsWater]

# LIQUID TYPES
# 1 = clean water
# 2 = sweet berry drink
# 3 = sweetened sweet berry drink
# 4 = dirty water
# 5 = sea water

# -> Operate on player
execute on target \
    if entity @s[gamemode=!creative] run \
        function overly_realistic:general/custom_blocks/basket/interactions/int_get_water_local

# -> Remove items
function overly_realistic:general/custom_blocks/basket/interactions/int_remove_all_items_include_additionals_harsh
