Testing for players within a specified rectangular area

Testing for players within a specified rectangular area - Aerial top view of spacious lush city district surrounded by modern skyscrapers in urban metropolis downtown

I'm trying to set up a pvp arena and need a command block to test for players within a specified set of coordinates. I need to take a rectangular area so please don't reply with /testfor @p[x=,y=,z=,r=]

I saw one thing about using [x,y,z,dx,dy,dz] but I couldn't get it to work, and as I've never used the (dx,dy,dz) before, I don't know if I input them correctly.



Best Answer

The delta parameters (dx, dy, dz) state the number of blocks from the origin (x, y, z) to the opposite corner of the rectangular area, rather than a second set of coordinates.

For example, the following looks for players with the first corner at (100, 64, 100) to the opposite corner at (105, 70, 105):

/testfor @a[100,64,100,dx=5,dy=6,dz=5]



Pictures about "Testing for players within a specified rectangular area"

Testing for players within a specified rectangular area - Building with brick wall and signboard with title indicating smoking area with symbol of cigarette
Testing for players within a specified rectangular area - Signboard with inscription on wall of pottery
Testing for players within a specified rectangular area - Assorted portable media players and heap of aged cellphones with black screens on gray background



How do you test a player in Minecraft in a certain area?

2. Type the Command
  • Test if Players are within 10 blocks. In this example, we will test to see if there are any players within a 10 block radius with the following command: /testfor @a[r=10] ...
  • Test if Mooshrooms are within 50 blocks. ...
  • Test if Nearest Player is at Level 20 experience.




  • Arbitrary Rectangle Collision Detection \u0026 Resolution - Complete!




    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: sergio souza, Zamaie Chinye, Erik Mclean, Skyler Ewing