
# -> If a display with the same rotation is already in this block then return and break
execute align xyz \
    if entity @n[type=interaction,tag=OverlyRealistic.Block.CavePainting_Rot_West,dx=0,dy=0,dz=0] \
    positioned ~0.5 ~0.5 ~0.5 run \
        return run \
            function overly_realistic:general/custom_blocks/cave_painting/cave_painting_break_from_placement with entity @s data

# -> Place display & interaction
$execute align xyz run \
    summon minecraft:text_display ~ ~0.125 ~0.5 {Tags:["OverlyRealistic.Block.CavePainting","OverlyRealistic.Block.CavePainting_Type_$(type)"],Passengers: [{id:"interaction",Tags:["OverlyRealistic.Block.CavePainting","OverlyRealistic.Block.CavePainting_Rot_West","OverlyRealistic.Block.CavePainting_Type_$(painting_type)","OverlyRealistic.Block.IsCustomBlock"],height:0.6f,width:0.5f,response:1b,data:{interaction_call:"overly_realistic:general/custom_blocks/cave_painting/player_interact_with_cave_painting",break_call:"overly_realistic:general/custom_blocks/cave_painting/cave_painting_broken_by_player"}}], alignment: "center", background: 0, default_background: 0b, line_width: 200, see_through: 0b, shadow: 0b, text: {color: "$(painting_color)", text: "$(painting_type)"}, text_opacity: -1b, transformation: {left_rotation: [0.0f, 0.7071068f, 0.0f, 0.7071068f], right_rotation: [0.0f, 0.0f, 0.0f, 1.0f], scale: [2.5957315f, 2.5957334f, 2.5957315f], translation: [0.0f, 0.0f, 0.05f]}}

# -> Set success
scoreboard players set #or.placement_success OverlyRealistic.General.ArbitraryData 1
