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

# -> Tag basket
tag @s add OverlyRealistic.Block.Basket_IsWaterLogged

# -> Reset water type
scoreboard players set #or.basket_water_place_type OverlyRealistic.General.ArbitraryData 0

# -> (@NOTE: why not just get the item from the global item display?)
# -> Get item
#execute on target run \
    item replace entity 00000001-0000-002b-0000-00010000002b contents from entity @s weapon.mainhand

# -> Set liquid
function overly_realistic:general/custom_blocks/basket/interactions/set_liquid/get_liquid_from_item

# -> If water is dirty then set tag
execute if score #or.basket_water_place_type OverlyRealistic.General.ArbitraryData matches 1..2 run \
    tag @s add OverlyRealistic.Block.Basket_HasDirtyWater

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

# -> Operate on player
execute on target run \
    function overly_realistic:general/custom_blocks/basket/interactions/int_place_water_local
