
# -> Attach new display
execute align xyz run \
    summon minecraft:item_display ~0.5 ~0.5 ~0.5 {Tags:["OverlyRealistic.TempEnt_HandleComponent_ToolHead","OverlyRealistic.Block.ToolHandle_ToolHead"], item_display:"head", transformation: {left_rotation: [-0.65089524f, 0.2762886f, 0.2762886f, 0.65089524f], right_rotation: [0.0f, 0.0f, 0.0f, 1.0f], scale: [1.0064176f, 1.006411f, 0.8749996f], translation: [0.5634207f, 0.2f, 0.13f]}}

execute align xyz run \
    ride @n[type=item_display,tag=OverlyRealistic.TempEnt_HandleComponent_ToolHead,dx=0,dy=0,dz=0] mount @s
execute on passengers run \
    tag @s remove OverlyRealistic.TempEnt_HandleComponent_ToolHead

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

# -> Set display item & play sound
execute on passengers \
    if entity @s[tag=OverlyRealistic.Block.ToolHandle_ToolHead] run \
        function overly_realistic:general/custom_blocks/tool_handle/interaction_events/progress_0/tool_head_dependent_operations
#execute on passengers \
    if entity @s[tag=OverlyRealistic.Block.ToolHandle_ToolHead] run \
        item modify entity @s contents overly_realistic:items/add_placed_model_to_tool_head

# -> 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_1",fallback:"[Requires cordage]\n[Required]"}

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