2

I am trying to setup a repeating command block that would teleport every entity with a specific name x blocks forward on x/z axis. In versions before 1.13 you could do this with the following command set on repeat:

/tp @e[name=Name] ~1 ~ ~

However as 1.13 formatting changed, I cannot find a command that would work the same way. If you know the command that would do this task please let me know! I have tried commands similar to the following:

/execute at @e[name=Name] run teleport @e[name=Name] ~1 ~ ~

This was the closest I could get but it only teleports every entity with that name infront of one of them. I had been trying to find a way to perform this simple thing for over a hour, including searching for answers

1

It took a bit of testing and thinking to figure this out. Since using @s didn't work, I came up with a not very pretty, but working command:

/execute at @e[name="Name"] run tp @e[name="Name",distance=0] ~1 ~ ~

This is the command that you had, but with the distance tag added. Now, every entity with that name will teleport only itself instead of every other entity with the same name.

2
  • 1
    Well that really did work, this was what i was looking for. Thanks for the find
    – user232211
    May 28 '19 at 15:04
  • 1
    @user232211 Feel free to mark one of the answers as accepted, so the question is considered solved.
    – Quijibo
    May 28 '19 at 15:27
1

You used @e twice, so you split up the command between all entities twice. You teleported every entity to every entity. This throws all your poor animals around the entire world many times in less than a second until they finally land at whatever spot happens to be the last one.

The solution is indeed @s, but that only works properly if "myself" actually means the entities you want, which you can change with /execute as:

/execute as @e[name="Name"] at @s run teleport ~1 ~ ~

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.