How can I teleport to an unloaded entity?

I am using invisible invulnerable ArmorStands to create "warps" and "homes" in a map. The idea is that I can spawn them in with a specific name, and then teleport a player back to them like this:

/tp @p @e[name=PlayerHome,type=ArmorStand]

These warps/homes need to be able to be moved, so I cannot just use static coordinates.

The ArmorStand method was working fine at first, however I have noticed that if the entity is not within spawn chunks or a radius of the player, I cannot teleport or interact with it in any way.

Is there any way I can teleport to a far-away entity? Or have it become loaded first?

I was thinking of doing something with /spreadplayers, which loads chunks that entities are spread to, but I cannot get it to target the unloaded ArmorStand.


Solution 1:

You can spawn a redstone block a certain numbers above or below the point of the player with an activator rail ontop. Then spawn a command minecart on the activator rail with the command /spreadplayers ~ ~ 1 false @e[name=PlayerHome,type=ArmorStand,c=1,r=2].

Because the /spreadplayers will load the chunk the entity is spread to, the commandblock minecart on the activator rail will permenantly keep the chunk that the armorstand is in loaded. When moving the point, run a fill command and a kill command at the previous home to remove the traces. When you are teleporting the player back to their home, you can simply offset the teleportation by a few blocks in the y coordinate.