# Create a "Box" With 2 set's of Coords

Comments in 'Plugin Development' started by CrazedMiner, May 24, 2015.

1. Offline

### CrazedMinerNotable MemberPlugin Developer

Joined:
Jan 31, 2015
Posts:
348
Plugins:
2
Minecraft User:
How would I create a "Box" using two sets of coords?

Any help is appreciated thanks!
2. Offline

### FalkStaff MemberGlobal Moderator

Joined:
Sep 2, 2013
Posts:
1,699
Plugins:
22
Minecraft User:
Not sure if this works, it's somewhere to start from
PHP:
``` public function makeBox(Block \$block, Vector3 \$a, Vector3 \$b, \$level = null){    if(\$level === null){        if(\$a instanceof Position) \$level = \$a->getlevel();        elseif(\$b instanceof Position) \$level = \$b->getlevel();        else{            throw new Exception("No level specified.");            return;        }    }    // I put these outside the loop so they aren't run every iteration    \$xMax = max(\$a->getX(), \$b->getX());    \$yMax = max(\$a->getY(), \$b->getY());    \$zMax = max(\$a->getZ(), \$b->getZ());    for(\$x = min(\$a->getX(), \$b->getX()); \$x <= \$xMax; \$x++){        for(\$y = min(\$a->getY(), \$b->getY()); \$y <= \$yMax; \$y++){            for(\$z = min(\$a->getZ(), \$b->getZ()); \$z <= \$zMax; \$z++){                \$level->setBlock(new Vector3(\$x, \$y, \$z), \$block);            }        }    }} ```
3. Offline

### PEMapModderNotable MemberPlugin Developer

Joined:
Oct 9, 2013
Posts:
7,230
Plugins:
11
Minecraft User:
Have a look at the pemapmodder\worldeditart\utils\spaces namespace.
CrazedMiner likes this.