Minecraft Java Edition – How to Teleport Player Around a Corner Facing a Specific Direction

minecraft-commandsminecraft-java-edition

I want to build some kind of non euclidian room in minecraft, where a player should be able to go 2..infinite amount of times around a corner, until he went full cyrcle. But it should only work in one direction. For example it might take 7 corners if you go clockwise and 4 corners counterclockwise.

Here on 0:42 you can see what i want to achive:
non euclidian geometry

In order to achive that i use command blocks to teleport the player on a point A, where he faces positive x direction, relative to his own offset to point B, where he faces positive y direction:
enter image description here

I tried using this command:

execute at @a[​X=A,Y=B, Z=C, distance=0..4] run tp @p ~-10 ~ ~-10 90 0

I am facing now three problems :

  1. I don't know how to check which direction the player is facing at given coordinate.

  2. When teleporting the player back while he is moving in x direction, the movement towards x
    stays after the teleportation. In my case i want him, if he moves in x direction before teleportation, to move in y direction after
    the teleportation.

  3. Since all rooms are exactly the same, the player should be teleported to the previous room facing now the previous direction. But after
    teleportation the position is slightly off. Imagine if you move in X direction, there are 4 possible Y coordinates to be teleported(Y1, Y2, Y3, Y4). Depending on which one you get teleported you should get to a different X coordinate
    (Y1 -> X1,.., Y4 -> X4), so the distances to the walls are the exact same. But how it now works is, that it doesnt matter in which Y you are, you will always get to the same X.

    For that reason I created a little formula, that would keep the distances to the walls the same, after teleportation. But i cant use the formula nor can I store the result and use it for the teleportation

Any suggestions?

Best Answer

All you have to do is /tp playername coords facing another coords For example Your Name Is GachaLelouch and the coords Is 1 2 3, All you have to do is /tp GachaLelouch 1 2 3 facing 1 2 3 If you want it to point towards a player you do /tp GachaLelouch 1 2 3 facing @p This command can't work if you teleport another player to another player.. You can do /execute GachaLelouch ~~~ tp GachaLelouch2 ~~~ facing 1 2 3