1

````````

SebastianHomes234's Avatar SebastianHomes2346/28/14 12:07 am history
1 emeralds 4.1k 3
6/28/2014 8:34 am
Skylinerw's Avatar Skylinerw
````````
Posted by SebastianHomes234's Avatar
SebastianHomes234
Level 2 : Apprentice Explorer
0

Create an account or sign in to comment.

3

1
06/28/2014 6:58 am
Level 2 : Apprentice Explorer
SebastianHomes234
SebastianHomes234's Avatar
I did come across this post myself before, I thought there would be still some way to detect player height, but I guess not...


Thanks,
Mrunited12
1
06/28/2014 8:34 am
Level 16 : Journeyman Engineer
Skylinerw
Skylinerw's Avatar
In 1.8, you can use a mix of the /execute command and delta coordinates. You'll have to do some trickery to ignore the x and z values. An example, testing for a player that is at Y64:

/execute @a ~ ~ ~ execute @p[y=64,dx=0,dy=0,dz=0] ~ ~ ~ testfor @p

The first /execute sets players as the new initiators, otherwise the x and z values would be that of the command block (meaning it would only detect players at Y64 above/below the command block).

This means the second /execute will use the players' own x/z coordinates, which will allow us to test for their Y coordinate anywhere in the world. The y is defined as 64, and the dy is set to 0 to only check that coordinate. The dx and dz values must be defined as well, though their values won't make any difference here. @p is used in order to target the initiating player, since all players are already executing the execute.

The resulting /testfor is just to obtain the positive signal silently. Any command at all can go there, including a /scoreboard command so you can target the player afterwards, and you'll still only receive a positive signal (and change in score) if the player is at Y64:

/execute @a ~ ~ ~ execute @p[y=64,dx=0,dy=0,dz=0] ~ ~ ~ scoreboard players set @p OBJECTIVE 1

If you're looking for players in a radius of 1000 from the command block, you'll apply that to the first execute:

/execute @a[r=1000] ~ ~ ~ execute @p[y=64,dx=0,dy=0,dz=0] ~ ~ ~ testfor @p
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome