# function main:game/wave/workshop/craft/list
# function main:mechanics/upgrades/choice with storage player_data 1
# function main:game/wave/workshop/craft/book
# kill @e[type=marker,tag=workshop]
# playsound atmos:workshop_1 master @a ~ ~ ~ 10 1
kill @e[type=#main:not_enemies,tag=workshop_ui]

summon interaction ^ ^4 ^ {width:0.5f,height:0.25f,response:1b,Tags:["button","workshop_ui"],Passengers:[{id:"minecraft:text_display",teleport_duration:1,Rotation:[0F,0F],alignment:"center",Tags:["button","workshop_ui"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,-0.25f,0f],scale:[1f,1f,1f]},text:'{"color":"gold","bold":true,"text":">Workshop<"}',background:7566195}]}

#buttons
execute if entity @a[tag=!workshop_room_craft] run summon interaction ^ ^3.5 ^ {width:0.5f,height:0.25f,response:1b,Tags:["button","craft","workshop_ui"],Passengers:[{id:"minecraft:text_display",teleport_duration:1,Rotation:[0F,0F],alignment:"center",Tags:["button","craft","workshop_ui"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,-0.25f,0f],scale:[1f,1f,1f]},text:'{"color":"green","text":"◯ Crafting 🔨"}',background:7566195}]}
execute if entity @a[tag=workshop_room_craft] run summon interaction ^ ^3.5 ^ {width:0.5f,height:0.25f,response:1b,Tags:["button","workshop_ui"],Passengers:[{id:"minecraft:text_display",teleport_duration:1,Rotation:[0F,0F],alignment:"center",Tags:["button","workshop_ui"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,-0.25f,0f],scale:[1f,1f,1f]},text:'[{"color":"green","text":"⬤ "},{"color":"gray","text":"Crafting 🔨"}]',background:7566195}]}

##upgrades
execute if entity @a[tag=!workshop_room_upgrade] if score .upgrades room matches ..0 run summon interaction ^ ^3 ^ {width:0.5f,height:0.25f,response:1b,Tags:["button","upgrade","workshop_ui"],Passengers:[{id:"minecraft:text_display",teleport_duration:1,Rotation:[0F,0F],alignment:"center",Tags:["button","upgrade","workshop_ui"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,-0.25f,0f],scale:[1f,1f,1f]},text:'{"color":"yellow","text":"◯◯ Upgrade 🔧"}',background:7566195}]}
execute if entity @a[tag=!workshop_room_upgrade] if score .upgrades room matches 1 run summon interaction ^ ^3 ^ {width:0.5f,height:0.25f,response:1b,Tags:["button","upgrade","workshop_ui"],Passengers:[{id:"minecraft:text_display",teleport_duration:1,Rotation:[0F,0F],alignment:"center",Tags:["button","upgrade","workshop_ui"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,-0.25f,0f],scale:[1f,1f,1f]},text:'{"color":"yellow","text":"⬤◯ Upgrade 🔧"}',background:7566195}]}
execute if entity @a[tag=!workshop_room_upgrade] if score .upgrades room matches 2.. run summon interaction ^ ^3 ^ {width:0.5f,height:0.25f,response:1b,Tags:["button","upgrade","workshop_ui"],Passengers:[{id:"minecraft:text_display",teleport_duration:1,Rotation:[0F,0F],alignment:"center",Tags:["button","upgrade","workshop_ui"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,-0.25f,0f],scale:[1f,1f,1f]},text:'{"color":"yellow","text":"⬤⬤ Upgrade 🔧"}',background:7566195}]}

execute if entity @a[tag=workshop_room_upgrade] if score .upgrades room matches 1 run summon interaction ^ ^3 ^ {width:0.5f,height:0.25f,response:1b,Tags:["button","upgrade","workshop_ui"],Passengers:[{id:"minecraft:text_display",teleport_duration:1,Rotation:[0F,0F],alignment:"center",Tags:["button","upgrade","workshop_ui"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,-0.25f,0f],scale:[1f,1f,1f]},text:'[{"color":"yellow","text":"⬤◯ "},{"text":"Upgrade 🔧","color":"gray"}]',background:7566195}]}
execute if entity @a[tag=workshop_room_upgrade] if score .upgrades room matches 2.. run summon interaction ^ ^3 ^ {width:0.5f,height:0.25f,response:1b,Tags:["button","upgrade","workshop_ui"],Passengers:[{id:"minecraft:text_display",teleport_duration:1,Rotation:[0F,0F],alignment:"center",Tags:["button","upgrade","workshop_ui"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,-0.25f,0f],scale:[1f,1f,1f]},text:'[{"color":"yellow","text":"⬤⬤ "},{"text":"Upgrade 🔧","color":"gray"}]',background:7566195}]}


summon interaction ^ ^2.25 ^ {width:0.5f,height:0.25f,response:1b,Tags:["button","workshop_ui"],Passengers:[{id:"minecraft:text_display",teleport_duration:1,Rotation:[0F,0F],alignment:"center",Tags:["button","workshop_ui"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,-0.25f,0f],scale:[0.7f,0.7f,0.7f]},text:'{"color":"gray","bold":false,"text":">Click on the options<"}',background:7566195}]}

#background
summon item_display ^-0.1 ^3.25 ^ {Tags:["background","workshop_ui"],Rotation:[0F,0F],shadow_strength:0f,shadow_radius:0f,brightness:{sky:15,block:0},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[2f,2.5f,0.1f]},item:{id:"minecraft:black_stained_glass"}}

scoreboard players add .workshop_visits progression 1