pocketmine\level\Position::add PHP Method

add() public method

public add ( $x, $y, $z )
    public function add($x, $y = 0, $z = 0)
    {
        if ($x instanceof Vector3) {
            return new Position($this->x + $x->x, $this->y + $x->y, $this->z + $x->z, $this->level);
        } else {
            return new Position($this->x + $x, $this->y + $y, $this->z + $z, $this->level);
        }
    }

Usage Example

 public function operate(Position $anchor)
 {
     if (is_int($this->delta)) {
         throw new \BadMethodCallException("MacroOperation is of type TRUE (wait) not FALSE (operate) thus cannot be operated");
     }
     $anchor->getLevel()->setBlock($anchor->add($this->delta), $this->block, false, true);
     // update
 }
All Usage Examples Of pocketmine\level\Position::add