execute as @s[nbt={Dimension:"minecraft:overworld",Inventory:[{id:"minecraft:golden_apple"}]}] run tag @e[name=DayQ] add HomeMadeQ
execute as @s[nbt={Dimension:"minecraft:overworld",Inventory:[{id:"minecraft:golden_apple"}]}] store result score @e[name=DayQ] PosX run data get entity @s Pos[0] 1
execute as @s[nbt={Dimension:"minecraft:overworld",Inventory:[{id:"minecraft:golden_apple"}]}] store result score @e[name=DayQ] PosY run data get entity @s Pos[1] 1
execute as @s[nbt={Dimension:"minecraft:overworld",Inventory:[{id:"minecraft:golden_apple"}]}] store result score @e[name=DayQ] PosZ run data get entity @s Pos[2] 1
#why????? execute at @s[nbt={Dimension:"minecraft:overworld",Inventory:[{id:"minecraft:golden_apple"}]}] run forceload add ~ ~
tellraw @s[nbt={Dimension:"minecraft:overworld",Inventory:[{id:"minecraft:golden_apple"}]}] ["",{"text":"The world home has been set!","color":"yellow"}]
execute as @s[nbt={Dimension:"minecraft:overworld",Inventory:[{id:"minecraft:golden_apple"}]}] run tellraw @a[tag=K] ["",{"text":"The world home has been set, at Coords ","color":"yellow"},{"score":{"name":"@e[name=DayQ,limit=1]","objective":"PosX","color":"gold"}},{"text":"x ","color":"yellow"},{"score":{"name":"@e[name=DayQ,limit=1]","objective":"PosY","color":"gold"}},{"text":"y ","color":"yellow"},{"score":{"name":"@e[name=DayQ,limit=1]","objective":"PosZ","color":"gold"}},{"text":"z.","color":"yellow"}]
tellraw @s[nbt=!{Dimension:"minecraft:overworld",Inventory:[{id:"minecraft:golden_apple"}]}] ["",{"text":"You must be in the overworld and have a golden apple in order to set a world home!","color":"gold"}]
clear @s[nbt={Dimension:"minecraft:overworld",Inventory:[{id:"minecraft:golden_apple"}]}] minecraft:golden_apple 1
scoreboard players set @s KyuSpells 0




###maaaaaybe use this?
#execute unless entity @e[type=marker,distance=..40,tag=KyuPreventSetHomeSpell] run execute as @s[nbt={Dimension:"minecraft:overworld",Inventory:[{id:"minecraft:golden_apple"}]}] run tag @e[name=DayQ] add HomeMadeQ
#execute unless entity @e[type=marker,distance=..40,tag=KyuPreventSetHomeSpell] run execute as @s[nbt={Dimension:"minecraft:overworld",Inventory:[{id:"minecraft:golden_apple"}]}] store result score @e[name=DayQ] PosX run data get entity @s Pos[0] 1
#execute unless entity @e[type=marker,distance=..40,tag=KyuPreventSetHomeSpell] run execute as @s[nbt={Dimension:"minecraft:overworld",Inventory:[{id:"minecraft:golden_apple"}]}] store result score @e[name=DayQ] PosY run data get entity @s Pos[1] 1
#execute unless entity @e[type=marker,distance=..40,tag=KyuPreventSetHomeSpell] run execute as @s[nbt={Dimension:"minecraft:overworld",Inventory:[{id:"minecraft:golden_apple"}]}] store result score @e[name=DayQ] PosZ run data get entity @s Pos[2] 1
#execute unless entity @e[type=marker,distance=..40,tag=KyuPreventSetHomeSpell] run #why????? execute at @s[nbt={Dimension:"minecraft:overworld",Inventory:[{id:"minecraft:golden_apple"}]}] run forceload add ~ ~
#execute unless entity @e[type=marker,distance=..40,tag=KyuPreventSetHomeSpell] run tellraw @s[nbt={Dimension:"minecraft:overworld",Inventory:[{id:"minecraft:golden_apple"}]}] ["",{"text":"The world home has been set!","color":"yellow"}]
#execute unless entity @e[type=marker,distance=..40,tag=KyuPreventSetHomeSpell] run execute as @s[nbt={Dimension:"minecraft:overworld",Inventory:[{id:"minecraft:golden_apple"}]}] run tellraw @a[tag=K] ["",{"text":"The world home has been set, at Coords ","color":"yellow"},{"score":{"name":"@e[name=DayQ,limit=1]","objective":"PosX","color":"gold"}},{"text":"x ","color":"yellow"},{"score":{"name":"@e[name=DayQ,limit=1]","objective":"PosY","color":"gold"}},{"text":"y ","color":"yellow"},{"score":{"name":"@e[name=DayQ,limit=1]","objective":"PosZ","color":"gold"}},{"text":"z.","color":"yellow"}]
#execute unless entity @e[type=marker,distance=..40,tag=KyuPreventSetHomeSpell] run tellraw @s[nbt=!{Dimension:"minecraft:overworld",Inventory:[{id:"minecraft:golden_apple"}]}] ["",{"text":"You must be in the overworld and have a golden apple in order to set a world home!","color":"gold"}]
#execute unless entity @e[type=marker,distance=..40,tag=KyuPreventSetHomeSpell] run clear @s[nbt={Dimension:"minecraft:overworld",Inventory:[{id:"minecraft:golden_apple"}]}] minecraft:golden_apple 1
#scoreboard players set @s KyuSpells 0
#
#
#execute if entity @e[type=marker,distance=..40,tag=KyuPreventSetHomeSpell] run tellraw @s ["",{"text":"A mysterious force prevents you from using this spell here.","color":"gold"}]