6

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.

15
  • Take a look at this video. It changes the spawn location in order to target an entity there, although this may not be appropriate for you.
    – MBraedley
    Sep 7, 2014 at 18:07
  • @MBraedley A good lead, although, as there is only one worldspawnpoint, it can only work with a single warp.
    – SirBenet
    Sep 7, 2014 at 19:41
  • I don't know much about command blocks, but it seems like if you needed to change the coords of a warp, you would have to run a command to change the location of the armor stands. Couldn't you instead run a command to change the command in another command block? I thought command modification was part of a recent update.
    – Johonn
    Sep 12, 2014 at 16:07
  • @Johonn You can, but you can only change it to what is typed into the command that is changing the the other command block. I want to be able to move it dynamically, say, with a /trigger SetHome command. If you can find a way to get player coordinates into a command block though, that would work.
    – SirBenet
    Sep 12, 2014 at 16:22
  • What exact functionality are you trying to implement? You say getting player coordinates would work. How would that solve your problem? I'm not sure I totally understand what you are trying to do.
    – Johonn
    Sep 13, 2014 at 1:27

3 Answers 3

6
+200

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.

4
  • Nice solution! Unless there are any improvements onto this (such as not using a clock for each warp) this'll get the bounty. Also, spreading an armorstand/entity that isn't the player home armorstand means that I don't have to worry about offsetting the Y, and can have this device right at bedrock.
    – SirBenet
    Sep 16, 2014 at 16:21
  • Wait.. Does it mean that /spreadplayers actually affect unloaded entities? I thought it only affects loaded entities.
    – aytimothy
    Sep 17, 2014 at 0:51
  • No the way this works is because the player is there when the point is set, the chunk is loaded. this device doesn't load an unloaded chunk, it simply prevents the chunk from unloading.
    – Moddl
    Sep 17, 2014 at 2:02
  • 1
    Btw this may not work after the world is reloaded
    – Moddl
    Aug 25, 2015 at 0:04
0

You can always just use this command if your server is in 1.14:

/forceload add < 1stchunk > < 2ndchunk >

just as if you were using /fill, put the xz of the first chunk location in the < 1stchunk >, and put the xz of the second chunk in the < 2ndchunk >. This will cause the specified chunks to always be loaded. Just be warned that this won't work if your server involves laggy things such as redstone, as if redstone is loaded in the lot, it will get very laggy.

-5

Just run this command and replace the name with the entity's name: /execute @e[name=*name*] ~ ~ ~ /tp @p @e[name=*name*]

1
  • 1
    Can you prove that this will work under the conditions set out by the asker? Additionally, it might not take the proper player, since it's executing from the entity position.
    – MBraedley
    Dec 22, 2014 at 22:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .