Assistance with some commands and syntax

1 emerald 3 replies 85 views | started 09/12/2017 7:23 pm by datacat_
Hey PMC,

Just wondering if there's anyone out there who would be able to provide some clarity to me in regards to some target selectors/arguments...

1) Is there a way that I could testforblock in an xyz range? For example, instead of just a single, specific xyz coordinate, is there a way to input something like "100 50-100 100"?

2) Is there a way to return the direction that a player is looking?

Thank you for taking the time to read my questions. I'm sure I'll have more as time goes on!
Posted by avatar
Level 1 : New Miner

3 replies

09/13/2017 10:50 pm
Level 1 New Miner
Alright, so I definitely made some progress, but I'm still having a little bit of difficulty with my command.

What I'm attempting to do is use testforblock to see if a particular block is above a player at all. Here's an example of the command I'm playing with...

This one works to detect a block of stone brick, relative to under a player (got this working for myself as a proof of concept before moving on to more complex commands):
/execute @a ~ ~ ~ /testforblock ~ ~-1 ~ minecraft:stonebrick

However, I cannot seem to get the following to work (checking to see if there is stonebrick within 10 blocks above the player):
/execute @a ~ ~ ~ /testforblock x=~ y=~ z=~ dx=0 dy=10 dz=0 minecraft:stonebrick

Is tilde notation not usable with the selectors?
09/13/2017 2:20 pm
Level 53 Grandmaster Cyborg
1.) Yes, use dx dy dz. These specify the range (so they're not a second set of coordinates!). For example:
testfor @a[x=10,y=5,z=10,dx=10,dy=-2,dz=30] will look for players in the area x1=10,y1=5,z1=10 -> x2=10+10=20,y2=5-2=3,z2=10+30=40. So x,y,z specify the starting point and dz,dy,dz specify the lengths.

2.) Return, not really. But you can test for ranges a player is looking in using rym,ry,rxm,rx as selector arguments.
rym and ry are the horizontal rotation minimum and maximum, rxm and rx are the vertical rotation minumum and maximum.
For example: testfor @a[rym=20,ry=30,rxm=10,rx=30]
The values can be easily found in the f3 menu.
09/13/2017 3:48 pm
Level 1 New Miner
Thank you so much for your reply. I'm at work right now, so I'll play around some later this evening and test this out. Thanks again!




© planetminecraft.com