Minecraft – Using spreadplayers to tp them to armorstand in unloaded chunk

minecraft-commandsminecraft-java-edition

I'm making a new public server. Right now, I have a book with set home / go home / tp to Spawn functionality. The set home uses a trigger that places an invisible armor stand named Home (and deletes the old one if one exists already) where the player is. The go home uses a trigger that teleports the player to the armorstand. The problem is is that if the chuck isn't loaded anymore, teleporting to the Home armor stand doesn't work either. Being a public server, using custom tp co-ordinates with each player's home in a command block from spawn isn't feasible, and from what I've seen about chunk loaders they're pretty big and hard to replicate.

I've been doing some looking around, and there seems to be a way to use the spreadplayers command to get someone to an entity with that name, but I can't find the exact commands to get it to work.

I also came across this article How can I teleport to an unloaded entity? and I basically went to 1000×1000 coordinates, and used the following commands to set a redstone block with an activated rail on top with a command block minecart on top of that using the suggested command:

/fill ~-1 250 ~-1 ~1 253 ~1 minecraft:bedrock 0 hollow

/fill ~ 251 ~ ~ 251 ~ redstone_block 0 replace

/fill ~ 252 ~ ~ 252 ~ activator_rail 0 replace

/summon MinecartCommandBlock ~ 252 ~ {Command:"/spreadplayers ~ ~ 1 false @e[name=Home,type=ArmorStand,c=1,r=2]"}

Then I used the sethome trigger to place the armor stand on the ground directly below the setup in the sky. The idea behind it was that when a player sets home, it's supposed to keep that chunk loaded (supposedly) so that the player can tp to the entity from a distance away. After testing, that still isn't working if I use the trigger to tp to the home entity.

I feel like I'm missing something or going about things in the wrong way. If the spread players command loads the chunk before teleporting a player there, is there a way to use the armorstand as a target with a range of 1 or something, or is there some way that I should be activating that command block minecart above the armorstand, or is there maybe another way to keep the chunk active?

Best Answer

I had to end up using another method to get the tp home functionality to work. The tp home link in the book now teleports the player to just above an End portal, which then teleports players within a radius to just above the portal out of the End.

I had to also create an end portal in the Nether at the same co-ords as in the Overworld (which you can do - forums were unclear about this), so that the same functionality still works in the Nether.

The set home link in the book now sets the players spawn point. So, if they die or tp home (tp to end portal then tp to portal out) they'll end up back at their home.

Hope this was helpful to someone else with the same issue.