add() public method

public add ( $x, $y, $z, $yaw, $pitch )
Example #1
0
 public function createTouchEffect(Location $position, $entityHeight, Location $damagerPosition, $damagerHeight)
 {
     if (isset($this->config["NU_EFFECT"]) && !$this->config["NU_EFFECT"]) {
         $position->getLevel()->addSound(new DoorSound($position));
         for ($i = 0; $i < 50; $i++) {
             $position->getLevel()->addParticle(new HeartParticle($position->add(mt_rand(-1, 1), mt_rand(-1, 1) + $entityHeight, mt_rand(-1, 1))));
         }
         for ($i = 0; $i < 50; $i++) {
             $damagerPosition->getLevel()->addParticle(new HeartParticle($damagerPosition->add(mt_rand(-1, 1), mt_rand(-1, 1) + $damagerHeight, mt_rand(-1, 1))));
         }
     } else {
         $position->getLevel()->addSound(new DoorSound($position));
         for ($i = 0; $i < 50; $i++) {
             $position->getLevel()->addParticle(new DustParticle($position->add(mt_rand(-1, 1) / 2, mt_rand(-1, 1) / 2 + $entityHeight, mt_rand(-1, 1) / 2), 153, 51, 255));
         }
         for ($i = 0; $i < 50; $i++) {
             $damagerPosition->getLevel()->addParticle(new DustParticle($damagerPosition->add(mt_rand(-1, 1) / 2, mt_rand(-1, 1) / 2 + $damagerHeight, mt_rand(-1, 1) / 2), 153, 51, 255));
         }
     }
 }