Minecraft 1.8: Check if player is at a specific Y position
Can you tell me if it is possible to use the testfor command to check if a player stands on a specific Y position?
I tried it with
/testfor @e[type=Player] {Pos:{Y:57d}}, but it won't work.
The error was [Player] did not match the required data structure
Best Answer
Use @p[y=<y value>], replacing with the y coordinate you wish to search.
Additionally, you can define a cubic search area with @p[x=<x value>,y=<y value>,z=<z value>], replacing <x value>, <y value>, and <z value> with their respective values.
Do not put spaces after the commas. For more information, visit:
http://minecraft.gamepedia.com/Tutorials/Command_Block http://minecraft.gamepedia.com/Commands
Pictures about "Minecraft 1.8: Check if player is at a specific Y position"



How do you know if a player is at a certain y level?
This can be tested out by using stairs, slowly walking up them, using F3 to check the y value while the command is running. The "hi" will appear even if not exactly at the desired y value.How to detect if a player is at a certain place! Java 1.16.1 COMMANDS IN DESCRIPTION
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: SHVETS production, SHVETS production, Kampus Production, Victoria Borodinova
