Inheritance: extends Entity
Example #1
0
 /**
  * Add an experience orb
  *
  * @param Vector3 $pos
  * @param int     $exp
  * @return bool|XPOrb
  */
 public function spawnXPOrb(Vector3 $pos, int $exp = 1)
 {
     if ($exp > 0) {
         $nbt = new CompoundTag("", ["Pos" => new ListTag("Pos", [new DoubleTag("", $pos->getX()), new DoubleTag("", $pos->getY() + 0.5), new DoubleTag("", $pos->getZ())]), "Motion" => new ListTag("Motion", [new DoubleTag("", 0), new DoubleTag("", 0), new DoubleTag("", 0)]), "Rotation" => new ListTag("Rotation", [new FloatTag("", 0), new FloatTag("", 0)]), "Experience" => new LongTag("Experience", $exp)]);
         $chunk = $this->getChunk($pos->x >> 4, $pos->z >> 4, false);
         $expOrb = new XPOrb($chunk, $nbt);
         $expOrb->spawnToAll();
         return $expOrb;
     }
     return false;
 }