Minecraft Command Block Remote Volume Selection

minecraft-commandsminecraft-java-edition

For some reason they thought it would be a good idea for the dx, dy, dz parameters to only ever extend from the command block itself. Is there a way, maybe combining this with execute, to select a volume remotely?

The goal is to see if players are within a rectangular prism region.

Best Answer

The x, y, and z arguments can select the starting corner of the search box:

/testfor @a[x=100,y=60,z=100,dy=10,dx=10,dz=10]

Or, more compactly:

/testfor @a[100,60,100,dx=10,dy=10,dz=10]