
# -> Attach new display
execute align xyz run \
    summon minecraft:item_display ~0.5 ~0.5 ~0.5 {Tags:["OverlyRealistic.TempEnt_HandleComponent_Cordage","OverlyRealistic.Block.ToolHandle_Cordage"], transformation: {left_rotation: [-0.7071068f, 0.0f, 0.0f, 0.7071068f], right_rotation: [0.0f, 0.0f, 0.0f, 1.0f], scale: [0.31250012f, 0.3125001f, 0.31250003f], translation: [0.0f, -0.155f, -0.45f]}}
execute align xyz run \
    ride @n[type=item_display,tag=OverlyRealistic.TempEnt_HandleComponent_Cordage,dx=0,dy=0,dz=0] mount @s
execute on passengers run \
    tag @s remove OverlyRealistic.TempEnt_HandleComponent_Cordage

# -> Rotate new display
execute on passengers \
    if entity @s[tag=OverlyRealistic.Block.ToolHandle_Cordage] \
    store result entity @s Rotation[0] float 1 \
    on vehicle run \
        data get entity @s data.display_rotation

# -> Set display item
execute on passengers \
    if entity @s[tag=OverlyRealistic.Block.ToolHandle_Cordage] run \
        item replace entity @s contents from entity 00000001-0000-002b-0000-00010000002b contents
execute on passengers \
    if entity @s[tag=OverlyRealistic.Block.ToolHandle_Cordage] run \
        item modify entity @s contents overly_realistic:multipurpose/set_to_one_item

# -> Set item place success
scoreboard players set #or.tool_handle_item_place_success OverlyRealistic.General.ArbitraryData 1

# -> Update text
execute on passengers run \
    data modify entity @s[tag=OverlyRealistic.Block.ToolHandle_Text] text set value {color:"black",translate:"block_tooltip.overlyrealistic.tool_handle.step_2",fallback:"[Requires adhesive]\n[Optional]"}

# -> Sound
playsound minecraft:item.lead.tied block @a ~ ~ ~ 0.35 1

# -> Increase progress
scoreboard players set @s OverlyRealistic.General.ArbitraryData 2

# --> Add to max_durability modifier & type value

# -> lead (durability: +650, type: 1)
execute if items entity 00000001-0000-002b-0000-00010000002b contents lead run \
    return run \
        function overly_realistic:general/custom_blocks/tool_handle/interaction_events/progress_1/set_item/lead

# -> crude string (durability: +200, type: 2)
execute if items entity 00000001-0000-002b-0000-00010000002b contents *[custom_data~{IsCrudeString:1b}] run \
    return run \
        function overly_realistic:general/custom_blocks/tool_handle/interaction_events/progress_1/set_item/crude_string

# -> string (durability: +450, type: 3)
execute if items entity 00000001-0000-002b-0000-00010000002b contents string run \
    return run \
        function overly_realistic:general/custom_blocks/tool_handle/interaction_events/progress_1/set_item/string

# -> vine (durability: +50, type: 4)
execute if items entity 00000001-0000-002b-0000-00010000002b contents vine run \
    return run \
        function overly_realistic:general/custom_blocks/tool_handle/interaction_events/progress_1/set_item/vine

# - lead (+650)
# - crude string (+200)
# - string (+450)
# - vine (+50)
