So once I was inspired by some game on another platform to make it's parkour moves in minecraft. I knew that without commands, I was not able to do it. Luckily, I have done some commands before and thought that it was possible with the command /execute.

Some time later after experimenting with commands to come up with how to boost the player up, i run into a problem.

I decide to make it a little more realistic by making sure that the player only jumped high when he/she was looking up. So of course, I try this command:

/execute at @p[y_rotation=-90] as @p[y_rotation=-90] if block ~ ~-0.01 ~ minecraft:stone run effect give @s minecraft:levitation 1 10

I tried it, but it seemed that it did not run the command when I was looking up. Since i'm a person that was discouraged from trying other choices, I came here to ask,

What is the command?


Solution 1:

You need to use the x axis if you want to test for players looking up/down. Testing for y is for players looking left or right.

So this will work (tested with 1.13.2):

/execute at @p[x_rotation=-90] as @p[x_rotation=-90] if block ~ ~-0.01 ~ minecraft:stone run effect give @s minecraft:levitation 1 10


Edit to clarify:

This is not a bug. You just need to think of the axis to be threaded and try to screw it in somewhere:

enter image description here

If you rotate X the player will look up or down and rotating Y will let them look left or right.