Minecraft Blogs / Tutorial

[Advanced Tutorial] A possible equivalence to the old /tp command in 1.13

  • 5,290 views, 0 today
  • 7
  • 3
  • 4
flashteens avatar flashteens
Level 62 : High Grandmaster Technomancer
*** Warning: This tutorial is designed for advanced map/server creators with some domain knowledge related to command blocks.

Also note that this tutorial is primarily designed for 1.12.x Java Edition players only. Minecraft PE players don't have to worry about the difference between commands /tp and /teleport since they are already the same, but you may probably indirectly understand how to make a command in MCPE that simulates the old /tp command in Java Edition.

Teleportation is an essential functionality in Minecraft maps or servers, as players may be immediately moved to different areas according to different storylines of a map, different lobbies/areas of a server, or some other use. Currently, both of the commands /tp and /teleport do move the player(s) or entities to a specified location in the world save, while their behaviors go different when relative coordinate is used. To unify these two commands that look similar but act differently, in the upcoming Minecraft 1.13 Mojang has decided to change the old /tp command to be an alias of /teleport, that is, the new /tp command is identical to /teleport. But there's one BIG problem...

Is there an alternative to the old /tp command in 1.13?

Well... Before talking about the alternative, let's see how to use these two commands in the current versions of Minecraft (applicable for 1.10.x - 1.12.x)

The syntax for the two commands are indeed similar, as shown below:
/tp [PlayersOrEntities] <x> <y> <z>
/teleport [PlayersOrEntities] <x> <y> <z>

According to Minecraft Wiki, for Minecraft versions 1.10.x - 1.12.x, "the primary difference between /tp and the /teleport command is that /tp uses coordinates relative to the teleported targets, while /teleport uses coordinates relative to the command's execution."

For an example, if we're about to write the following teleportation command in a command block:
/tp @a[r=3] ~8 ~ ~This command moves each player matching the target selector 8 blocks eastward from his/her previous location. For a server with four players A, B, C, and D, where the first three matches the target selector condition: r=3 (which will become distance=3 in 1.13), the following image shows the scenario:
[Advanced Tutorial] A possible equivalence to the old /tp command in 1.13

However, if we change the command into /teleport:
/teleport @a[r=3] ~8 ~ ~then all matched players are moved to the same location which is 8 block east to the command block:
[Advanced Tutorial] A possible equivalence to the old /tp command in 1.13

As seen above, /tp and /teleport are different commands in Minecraft 1.10.x - 1.12.x. But, their behaviors will become the same in 1.13, and the behavior of old /tp command will no longer exist. However, don't worry about that as I wrote this tutorial to solve such an issue!

Here is a clever and valid idea to have an equivalent command in 1.13 to the old /tp behavior, as long as Dinnerbone won't change his mind.

But, before talking about anything with 1.13, let's see if any combination with other 1.12 commands can be equivalent to /tp. Actually, here is indeed a solution:

/tp [PlayersOrEntities] <x> <y> <z>is equivalent to the following command:
/execute [PlayersOrEntities] ~ ~ ~ teleport @s <x> <y> <z>
In this solution, /execute is applied so as to run the command /teleport once on behalf of each entity matching the target selector. More precisely, the 2nd command above can be explained as: For each player/entity matching the target selector, run the teleportation command on behalf of him/her at his/her current location ("~ ~ ~").

For those who have computer programming experience, the following explanation may even fit you more:
The 2nd command (/execute) run the /teleport command inside a foreach-loop that "iterates all entities matching the conditions given by the target selector."

As for the target selector "@s" used after the command "teleport", it means the entity that executes the command. The following demonstration helps you understand how @s work in the /execute command.

Assumed that the command (as shown below) will teleport players A, B, C:
/execute [PlayersOrEntities] ~ ~ ~ teleport @s ~8 ~ ~and it can be thus explained as if the following three commands are executed at the same time:
/execute A ~ ~ ~ teleport A ~8 ~ ~
/execute B ~ ~ ~ teleport B ~8 ~ ~
/execute C ~ ~ ~ teleport C ~8 ~ ~
So each of the 3 players can be moved 8 block eastward to his/her own current position.

"One question. Is the following command identical to the command above?"
/execute [PlayersOrEntities] ~ ~ ~ teleport [PlayersOrEntities] ~8 ~ ~The answer is NO. Let's see what's wrong with that...

Different to the behavior as explained above, instead, this command can be interpreted as below:
/execute A ~ ~ ~ teleport (All of A, B, and C) ~8 ~ ~
/execute B ~ ~ ~ teleport (All of A, B, and C) ~8 ~ ~
/execute C ~ ~ ~ teleport (All of A, B, and C) ~8 ~ ~
or more precisely:
/execute A ~ ~ ~ teleport A ~8 ~ ~
/execute A ~ ~ ~ teleport B ~8 ~ ~
/execute A ~ ~ ~ teleport C ~8 ~ ~
/execute B ~ ~ ~ teleport A ~8 ~ ~
/execute B ~ ~ ~ teleport B ~8 ~ ~
/execute B ~ ~ ~ teleport C ~8 ~ ~
/execute C ~ ~ ~ teleport A ~8 ~ ~
/execute C ~ ~ ~ teleport B ~8 ~ ~
/execute C ~ ~ ~ teleport C ~8 ~ ~

For this case, as each of Lines 2, 3, 4, 6, 7, and 8 in such a decomposition does not move the corresponding player relative to his/her own position, the result would be unexpected. Also, due to the fact that each player has been teleported 3 times, it is possible that each of them would be moved 24 blocks away instead of 8 blocks!

Finally, let's translate the equivalent 1.12 command into 1.13.

Now, let's translate the following 1.12 command:
/execute [PlayersOrEntities] ~ ~ ~ teleport @s ~8 ~ ~into the following 1.13 one:
/execute as [PlayersOrEntities] then teleport @s ~8 ~ ~or replacing /teleport with /tp, which is equivalent to /teleport in 1.13:
/execute as [PlayersOrEntities] then tp @s ~8 ~ ~
See on Dinnerbone's official documentation or Minecraft Wiki for the more detailed syntax for the new /execute command.

That's the end for this tutorial and thank you for reading! Welcome to reply here for any of your suggestions or comments!! Also, don't forget to give your DIAMOND and FAVORITE here, and SUBSCRIBE me!! ^_^

Create an account or sign in to comment.

09/10/2018 9:51 am
Level 36 : Artisan Miner
OliBear avatar

This is a great tutorial but I'm still a little stuck. It's been a little while since I played minecraft but I'm trying to build a "magical" tower for my little sister, where you go into the basement, and it teleports you to the top of the tower whilst looking like you only travelled down. I hope that makes sense. But anyway, I've done it in older java builds, but I have to do it in bedrock edition and now when I do it I can't seem to make it look seamless like I used to.

I've tried using the last command line (/execute as [PlayersOrEntities] then tp @s ~ ~ ~) to see if it would be more seamless than the method I am currently using, but I keep getting a syntax error on the playersorentities part.

I hope this makes sense.



Figured it out now. The specific command I needed to run was

/execute @a[r=4] ~ ~ ~ tp @s ~5 ~176 ~

This tutorial was a massive help though so thanks a bunch :)
09/10/2018 11:13 am
Level 62 : High Grandmaster Technomancer
flashteens avatar
I wrote this blog post when 1.13 was still available in snapshot versions only, but a few months later I found that the syntax has changed again, so in the release version of 1.13/1.13.1, the syntax has become:
/execute as [PlayersOrEntities] at @s run tp @s ~ ~ ~

BTW, thanks for your support. 😉
05/08/2018 10:30 am
Level 64 : High Grandmaster Artist
Adventquest avatar
Great tutorial thanks ;).
05/09/2018 9:00 am
Level 62 : High Grandmaster Technomancer
flashteens avatar
Welcome :-)
Planet Minecraft


© 2010 - 2022