
# -> If basket is full then return
execute if score @s OverlyRealistic.World.BlockItemAmount matches 9.. run \
    return fail

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

# -> Set possibility score
scoreboard players set #or.global OverlyRealistic.General.ArbitraryData 1

# -> Add and store new item amount
execute store result storage overly_realistic:temp_values generic_value_0 int 1 run \
    scoreboard players add @s OverlyRealistic.World.BlockItemAmount 1

# --> Add item

# -> Create new item depending on item amount
function overly_realistic:general/custom_blocks/basket/interactions/create_displayed_item/create_new_item with storage overly_realistic:temp_values

# -> Attach to display
ride @n[type=item_display,tag=OverlyRealistic.Block.BasketItemNotAttached,distance=..0.5] mount @n[type=block_display,tag=OverlyRealistic.Block.Basket,distance=..0.5]

# -> Set data for item
execute as @n[type=block_display,tag=OverlyRealistic.Block.Basket,distance=..0.5] \
    on passengers \
    if entity @s[type=item_display,tag=OverlyRealistic.Block.BasketItemNotAttached] run \
        function overly_realistic:general/custom_blocks/basket/interactions/int_add_item_general_item_data

# -> Append new item data
data modify entity @s data.BasketItems append from entity 00000001-0000-002b-0000-00010000002b item
