
# -> If table has no paper then return
execute if entity @s[tag=!OverlyRealistic.Block.ScribingTable_HasPaper] run \
    return fail

# -> Sound
playsound overlyrealistic:block.scribing_table.paper_complete block @a ~ ~ ~ 0.5 1

# -> Get symbols' IDs
execute store result storage overly_realistic:blocks scribing_table.symbol_id_0 byte 1 run \
    scoreboard players get @s OverlyRealistic.World.ScribingTable_SymbolPart_0
execute store result storage overly_realistic:blocks scribing_table.symbol_id_1 byte 1 run \
    scoreboard players get @s OverlyRealistic.World.ScribingTable_SymbolPart_1
execute store result storage overly_realistic:blocks scribing_table.symbol_id_2 byte 1 run \
    scoreboard players get @s OverlyRealistic.World.ScribingTable_SymbolPart_2
execute store result storage overly_realistic:blocks scribing_table.symbol_id_3 byte 1 run \
    scoreboard players get @s OverlyRealistic.World.ScribingTable_SymbolPart_3

# -> Reset completion status
scoreboard players set #or.scribing_table_completed OverlyRealistic.General.ArbitraryData 0

# -> Execute completion function
function overly_realistic:general/custom_blocks/scribing_table/interactions/completion/set_completion with storage overly_realistic:blocks scribing_table

# -> If completion was successful then return
execute if score #or.scribing_table_completed OverlyRealistic.General.ArbitraryData matches 1 run \
    return fail

# -> Remove items
item replace entity 00000001-0000-002b-0000-00010000002b contents with air
function overly_realistic:general/custom_blocks/scribing_table/interactions/int_remove_items
