Inheritance: extends Animal
Example #1
0
 public function addLightning(Vector3 $pos, $autoRemoveTime = 3)
 {
     $nbt = new CompoundTag("", ["Pos" => new EnumTag("Pos", [new DoubleTag("", $pos->getX()), new DoubleTag("", $pos->getY()), new DoubleTag("", $pos->getZ())]), "Motion" => new EnumTag("Motion", [new DoubleTag("", 0), new DoubleTag("", 0), new DoubleTag("", 0)]), "Rotation" => new EnumTag("Rotation", [new FloatTag("", 0), new FloatTag("", 0)])]);
     $chunk = $this->getChunk($pos->x >> 4, $pos->z >> 4, false);
     $lightning = new Lightning($chunk, $nbt);
     $lightning->spawnToAll();
     $this->server->getScheduler()->scheduleDelayedTask(new CallbackTask([$lightning, "close"]), $autoRemoveTime * 20);
 }
Example #2
0
 /**
  * Add a lightning
  *
  * @param Vector3 $pos
  * @return Lightning
  */
 public function spawnLightning(Vector3 $pos) : Lightning
 {
     $nbt = new CompoundTag("", ["Pos" => new ListTag("Pos", [new DoubleTag("", $pos->getX()), new DoubleTag("", $pos->getY()), 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)])]);
     $chunk = $this->getChunk($pos->x >> 4, $pos->z >> 4, false);
     $lightning = new Lightning($chunk, $nbt);
     $lightning->spawnToAll();
     return $lightning;
 }