pocketmine\level\Position::setComponents PHP Method

setComponents() public method

public setComponents ( $x, $y, $z ) : Position
$x
$y
$z
return Position
    public function setComponents($x, $y, $z)
    {
        $this->x = $x;
        $this->y = $y;
        $this->z = $z;
        return $this;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @priority high
  */
 public function onDeath(PlayerRespawnEvent $event)
 {
     $level = $event->getPlayer()->getLevel();
     $pillarPos = new Position($event->getPlayer()->x, $event->getPlayer()->y, $event->getPlayer()->z, $level);
     for ($h = 1; $h <= 30; $h++) {
         $pillarPos->setComponents($pillarPos->x, ++$pillarPos->y, $pillarPos->z);
         $level->addParticle(new RedstoneParticle($pillarPos, 10));
     }
     $pillarPos->setComponents($pillarPos->x, $pillarPos->y - 10, $pillarPos->z);
     $headPos = new Position($pillarPos->x, $pillarPos->y, $pillarPos->z, $level);
     for ($r = -5; $r <= 5; $r++) {
         $headPos->setComponents($pillarPos->x + $r, $pillarPos->y, $pillarPos->z);
         $level->addParticle(new ExplodeParticle($headPos));
         $p = new RedstoneParticle($headPos, 10);
         $level->addParticle($p);
     }
 }
All Usage Examples Of pocketmine\level\Position::setComponents