tp @e[type=block_display,tag=main_menu] 62 -58 7 -180 0

kill @e[type=text_display,tag=coral_detection]
kill @e[type=interaction,tag=coral_detection]

execute if entity @a[tag=coral_detection] at @a run playsound block.coral_block.break master @a ~ ~ ~ 10 0.8
execute if entity @a[tag=coral_detection] run summon interaction ^-1 ^0.25 ^4 {width:3f,height:0.25f,response:1b,Tags:["button","setting","coral_detection_on","coral_detection"],Passengers:[{id:"minecraft:text_display",teleport_duration:1,Rotation:[0F,0F],alignment:"center",Tags:["button","setting","text","coral_detection_on","coral_detection"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,-0.25f,1.5f],scale:[0.75f,0.75f,0.75f]},text:'[{"color":"yellow","text":"Coral Detection (EXP): "},{"color":"green","text":"[On]","bold":true}]',background:7566195}]}

execute if entity @a[tag=coral_detection] run tellraw @a [{"bold":false,"color":"yellow","text":"[You can now "},{"bold":true,"color":"red","text":"HOLD LEFT CLICK"},{"bold":false,"color":"yellow","text":" to use normal attacks.]"}]
execute if entity @a[tag=coral_detection] run tellraw @a [{"bold":false,"color":"yellow","text":"["},{"bold":true,"color":"red","text":"BEWARE!"},{"bold":false,"color":"yellow","text":" This might introduce unwanted lag and lower the TPS. This is also an"},{"bold":false,"color":"red","text":" EXPERIMENTAL FEATURE"},{"bold":false,"color":"yellow","text":", that might not work properly. Use at your own risk]"}]

execute if entity @a[tag=!coral_detection] at @a run playsound block.coral_block.break master @a ~ ~ ~ 10 0.5
execute if entity @a[tag=!coral_detection] run summon interaction ^-1 ^0.25 ^4 {width:3f,height:0.25f,response:1b,Tags:["button","setting","coral_detection_off","coral_detection"],Passengers:[{id:"minecraft:text_display",teleport_duration:1,Rotation:[0F,0F],alignment:"center",Tags:["button","setting","text","coral_detection_off","coral_detection"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,-0.25f,1.5f],scale:[0.75f,0.75f,0.75f]},text:'[{"color":"yellow","text":"Coral Detection (EXP): "},{"color":"red","text":"[Off]","bold":true}]',background:7566195}]}

execute if entity @a[tag=!coral_detection] run tellraw @a [{"bold":false,"color":"yellow","text":"[HOLD LEFT CLICK is "},{"bold":true,"color":"green","text":"disabled"},{"bold":false,"color":"yellow","text":"]"}]