Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if($item->getId() === Item::SPAWN_EGG and $item->getDamage() === 0) {
- $player = $event->getPlayer();
- $nbt = new CompoundTag("", [
- "Pos" => new ListTag("Pos", [
- new DoubleTag("", $player->x),
- new DoubleTag("", $player->y + $player->getEyeHeight()),
- new DoubleTag("", $player->z)]),
- "Motion" => new ListTag("Motion", [
- new DoubleTag("", 0),
- new DoubleTag("", 0),
- new DoubleTag("", 0)]),
- "Rotation" => new ListTag("Rotation", [
- new FloatTag("", $player->yaw),
- new FloatTag("", $player->pitch)])
- ]);
- $nbt->setByte("Color", $cwplayer->getTeam() == BedwarsCW::RED ? \pocketmine\block\utils\Color::RED : \pocketmine\block\utils\Color::BLUE);
- $sheep = Sheep::createEntity(13, $player->getLevel(), $nbt);
- $attackplayers = [];
- foreach ($this->bw->getServer()->getOnlinePlayers() as $pap) {
- $cwpap = new CWPlayer($pap);
- if($cwpap->getTeam() != $cwplayer->getTeam()) {
- $attackplayers[] = $pap->getName();
- }
- }
- if($sheep instanceof Sheep) {
- $sheep->TNTSheepBehavior([$attackplayers]);
- }
- if ($sheep instanceof Entity) {
- if ($sheep instanceof Mob) {
- $sheep->setImmobile(!$player->getServer()->mobAiEnabled);
- $sheep->playLivingSound();
- }
- $nbt = PrimedTNT::createBaseNBT(new Vector3($sheep->x, $sheep->y+0.5, $sheep->z));
- $nbt->setShort("Fuse", 450);
- $tnt = PrimedTNT::createEntity("PrimedTNT", $sheep->getLevel(), $nbt);
- $sheep->spawnToAll();
- $tnt->spawnToAll();
- $tnt->mountEntity($sheep);
- if($sheep instanceof Sheep and $tnt instanceof PrimedTNT) {
- $this->bw->getScheduler()->scheduleDelayedTask(new explodeTask($sheep, $tnt), 380);
- }
- }
- if($player->isSurvival()) {
- $this->setPrice($player, 1, Item::SPAWN_EGG);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement