#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#
#    This function has been created by Skilendarz Group.
#             https://skilendarz.com
#
#      GIVE MAP MAKERS THE CREDIT THEY DESERVE!
#             COPYING IS PROHIBITED!
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

scoreboard players operation no_traget pos_x = @s pos_x
scoreboard players operation no_traget pos_y = @s pos_y
scoreboard players operation no_traget pos_z = @s pos_z
scoreboard players add @s notarget 1

#Fake potition
execute if score @s notarget matches 1 run scoreboard players add no_traget pos_x 100

execute if score @s notarget matches 2 run scoreboard players add no_traget pos_x 100
execute if score @s notarget matches 2 run scoreboard players add no_traget pos_z 100

execute if score @s notarget matches 3 run scoreboard players add no_traget pos_z 100

execute if score @s notarget matches 4 run scoreboard players add no_traget pos_z 100
execute if score @s notarget matches 4 run scoreboard players remove no_traget pos_x 100

execute if score @s notarget matches 5 run scoreboard players remove no_traget pos_x 100

execute if score @s notarget matches 6 run scoreboard players remove no_traget pos_x 100
execute if score @s notarget matches 6 run scoreboard players remove no_traget pos_z 100

execute if score @s notarget matches 7 run scoreboard players remove no_traget pos_z 100

execute if score @s notarget matches 8 run scoreboard players remove no_traget pos_z 100
execute if score @s notarget matches 8 run scoreboard players add no_traget pos_x 100

#Save compass
execute store result block 14 107 -23 Items[0].tag.LodestonePos.X double 0.1 run scoreboard players get no_traget pos_x
execute store result block 14 107 -23 Items[0].tag.LodestonePos.Y double 0.1 run scoreboard players get no_traget pos_y
execute store result block 14 107 -23 Items[0].tag.LodestonePos.Z double 0.1 run scoreboard players get no_traget pos_z

scoreboard players set @s[scores={notarget=8..}] notarget 0

#Info
title @s[tag=hold_compass,team=!seeker] actionbar ["",{"translate":"compass.tracking"},{"text":": "},{"translate":"compass.item.none","color":"gray","bold":true},{"text":" - ","color":"none","bold":false},{"translate":"compass.distance","color":"none"},{"text":": ","color":"none"},{"text":"0.0m","color":"green","bold":true}]
title @s[tag=hold_compass,team=seeker,scores={cooldown=0}] actionbar ["",{"translate":"compass.no_gold"}]
tag @s[tag=hold_compass,team=seeker] add compass_title

#Update compass
item replace entity @s hotbar.8 from block 14 107 -23 container.0