0

I've been trying to create a command block where the player places down a spawn egg and they will be teleported in front of them. I have already figured out the spawn egg part but I can't figure out the teleport part. (Also the spawn egg is a chicken)

2
  • so do they teleport to where the thing spawns? or just 5 blocks ahead no matter where it spawns? – Topcode Dec 30 '20 at 19:18
  • 5 blocks ahead no mater where it spawns – darthvader1925 Dec 30 '20 at 19:19
1

Your command is the following.

execute as <selector> at @s run tp ^ ^ ^5

That will teleport you 5 blocks in front of you. The ^ are used for cords relative to what your head rotation is. The first ^ is for left/right. The second is for up/down(positive being up and negative being down). The last one is for forward/backward(positive being forward and negative being backward). Remember, these are relative to what your head rotation is. Make sure to execute the to command as the entity you want to tp.

2
  • I had to switch @s to @p though because @s wouldn't work. – darthvader1925 Dec 30 '20 at 19:25
  • @darthvader1925 if you replaced <selector> with your selector like @a it should have been fine. – randomuser922 Dec 30 '20 at 21:57

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.