
# -> Get player's item
item replace entity 00000001-0000-002b-0000-00010000002b contents from entity @s weapon.mainhand

# -> If player is crouching then return and set ID
execute if score @s OverlyRealistic.PredicateValue.IsSneaking matches 1 run \
    return run \
        scoreboard players set #or.scribing_table_interaction_id OverlyRealistic.General.ArbitraryData 1

# -> Get player's scribing level
scoreboard players operation #or.scribing_table_user_scribing_level OverlyRealistic.General.ArbitraryData = @s OverlyRealistic.Player.WisdomStats.Scribing

# -> If player is not using an item then return and set ID
execute unless items entity 00000001-0000-002b-0000-00010000002b contents * run \
    return run \
        scoreboard players set #or.scribing_table_interaction_id OverlyRealistic.General.ArbitraryData 4

# -> If player is holding a paper then return and set ID
execute if items entity 00000001-0000-002b-0000-00010000002b contents paper run \
    return run \
        scoreboard players set #or.scribing_table_interaction_id OverlyRealistic.General.ArbitraryData 2

# -> If player is holding a writable item then return and set ID
execute if items entity 00000001-0000-002b-0000-00010000002b contents *[custom_data~{or_can_write_on_scribing_table:1b}] run \
    return run \
        scoreboard players set #or.scribing_table_interaction_id OverlyRealistic.General.ArbitraryData 3

# -> If player is using a paper draft then return and set ID
execute if items entity 00000001-0000-002b-0000-00010000002b contents *[custom_data~{or_is_paper_draft:1b}] run \
    return run \
        scoreboard players set #or.scribing_table_interaction_id OverlyRealistic.General.ArbitraryData 5
