
# --> Interaction checks

# -> Store currently used item
item replace entity 00000001-0000-002b-0000-00010000002b contents from entity @s weapon.mainhand overly_realistic:items/set_1_count

# -> Stir basket
execute if items entity @s weapon.mainhand *[custom_data~{IsSpoon:1b}] run \
    return run \
        scoreboard players set #or.basket_interaction_type OverlyRealistic.General.ArbitraryData 1

# -> Place water items
execute if items entity @s weapon.mainhand potion run \
    return run \
        scoreboard players set #or.basket_interaction_type OverlyRealistic.General.ArbitraryData 2
execute if items entity @s weapon.mainhand *[custom_data~{or_bucket_is_filled:1b}] \
    unless items entity @s weapon.mainhand *[custom_data~{or_bucket_contents:"lava"}] \
    unless items entity @s weapon.mainhand *[custom_data~{or_bucket_contents:"milk"}] run \
        return run \
            scoreboard players set #or.basket_interaction_type OverlyRealistic.General.ArbitraryData 2
execute if items entity @s weapon.mainhand *[custom_data~{IsWaterBucket:1b}] run \
    return run \
        scoreboard players set #or.basket_interaction_type OverlyRealistic.General.ArbitraryData 2

# -> Get water items
execute if items entity @s weapon.mainhand #overly_realistic:basket_interactables/can_get_water run \
    return run \
        scoreboard players set #or.basket_interaction_type OverlyRealistic.General.ArbitraryData 3
execute if items entity @s weapon.mainhand *[custom_data~{or_bucket_contents:"empty"}] run \
    return run \
        scoreboard players set #or.basket_interaction_type OverlyRealistic.General.ArbitraryData 3

# -> If the player is not holding any items then remove items
execute unless items entity @s weapon.mainhand * run \
    return run \
        scoreboard players set #or.basket_interaction_type OverlyRealistic.General.ArbitraryData 4

# -> Reset score
#scoreboard players set #or.global OverlyRealistic.General.ArbitraryData 0

# -> Add items
scoreboard players set #or.basket_interaction_type OverlyRealistic.General.ArbitraryData 5

# -> Decrease item amount if possible
#execute if score #or.global OverlyRealistic.General.ArbitraryData matches 1 run \
    item modify entity @s[gamemode=!creative] weapon.mainhand overly_realistic:multipurpose/remove_one_item
