
# -> If player does not have a stick in hand then return
execute unless items entity @s weapon.mainhand stick[!custom_data] run \
    return run \
        function overly_realistic:general/custom_blocks/dry_tinder/player_interact_with_dry_tinder_no_stick

# -> Tag player
tag @s add OverlyRealistic.Player.TempPlayer

# --> Interaction checks

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

# -> Cap item amount
data modify entity 00000001-0000-002b-0000-00010000002b item.count set value 1

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

# -> Add stick to dry tinder
execute as @n[type=interaction,tag=OverlyRealistic.Block.DryTinder,distance=..64,nbt={interaction:{}}] \
    unless score @s OverlyRealistic.General.ArbitraryData matches 10.. \
    at @s \
    align xyz \
    positioned ~0.5 ~0.5 ~0.5 run \
        function overly_realistic:general/custom_blocks/dry_tinder/interactions/add_stick

# -> Tag player
tag @s remove OverlyRealistic.Player.TempPlayer

# -> 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
