Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.78 KB | None | 0 0
  1. if($item->getId() === Item::SPAWN_EGG and $item->getDamage() === 0) {
  2.             $player = $event->getPlayer();
  3.             $nbt = new CompoundTag("", [
  4.                 "Pos" => new ListTag("Pos", [
  5.                     new DoubleTag("", $player->x),
  6.                     new DoubleTag("", $player->y + $player->getEyeHeight()),
  7.                     new DoubleTag("", $player->z)]),
  8.                 "Motion" => new ListTag("Motion", [
  9.                     new DoubleTag("", 0),
  10.                     new DoubleTag("", 0),
  11.                     new DoubleTag("", 0)]),
  12.                 "Rotation" => new ListTag("Rotation", [
  13.                     new FloatTag("", $player->yaw),
  14.                     new FloatTag("", $player->pitch)])
  15.             ]);
  16.             $nbt->setByte("Color", $cwplayer->getTeam() == BedwarsCW::RED ? \pocketmine\block\utils\Color::RED : \pocketmine\block\utils\Color::BLUE);
  17.             $sheep = Sheep::createEntity(13, $player->getLevel(), $nbt);
  18.             $attackplayers = [];
  19.             foreach ($this->bw->getServer()->getOnlinePlayers() as $pap) {
  20.                 $cwpap = new CWPlayer($pap);
  21.                 if($cwpap->getTeam() != $cwplayer->getTeam()) {
  22.                     $attackplayers[] = $pap->getName();
  23.                 }
  24.             }
  25.             if($sheep instanceof Sheep) {
  26.                 $sheep->TNTSheepBehavior([$attackplayers]);
  27.             }
  28.             if ($sheep instanceof Entity) {
  29.                 if ($sheep instanceof Mob) {
  30.                     $sheep->setImmobile(!$player->getServer()->mobAiEnabled);
  31.                     $sheep->playLivingSound();
  32.                 }
  33.                 $nbt = PrimedTNT::createBaseNBT(new Vector3($sheep->x, $sheep->y+0.5, $sheep->z));
  34.                 $nbt->setShort("Fuse", 450);
  35.                 $tnt = PrimedTNT::createEntity("PrimedTNT", $sheep->getLevel(), $nbt);
  36.                 $sheep->spawnToAll();
  37.                 $tnt->spawnToAll();
  38.                 $tnt->mountEntity($sheep);
  39.                 if($sheep instanceof Sheep and $tnt instanceof PrimedTNT) {
  40.                     $this->bw->getScheduler()->scheduleDelayedTask(new explodeTask($sheep, $tnt), 380);
  41.                 }
  42.             }
  43.             if($player->isSurvival()) {
  44.                 $this->setPrice($player, 1, Item::SPAWN_EGG);
  45.             }
  46.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement