本文整理汇总了PHP中pocketmine\event\player\PlayerInteractEvent::getFace方法的典型用法代码示例。如果您正苦于以下问题:PHP PlayerInteractEvent::getFace方法的具体用法?PHP PlayerInteractEvent::getFace怎么用?PHP PlayerInteractEvent::getFace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\event\player\PlayerInteractEvent
的用法示例。
在下文中一共展示了PlayerInteractEvent::getFace方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onBlock
public function onBlock(PlayerInteractEvent $event)
{
if (!$event->getPlayer()->hasPermission("Farms")) {
return;
}
$block = $event->getBlock()->getSide(1);
$blockid = $block->getID();
$itemid = $event->getItem()->getID();
$itemdamage = $event->getItem()->getDamage();
if ($itemid == 351 and $itemdamage == 3) {
$tree = $event->getBlock()->getSide($event->getFace());
if ($tree->getID() == 17 or $tree->getDamage() == 3) {
$event->getBlock()->getLevel()->setBlock($event->getBlock()->getSide($event->getFace()), new CocoaBeanBlock($event->getFace()), true, true);
return true;
}
}
if ($event->getBlock()->getID() == Item::FARMLAND or $event->getBlock()->getID() == Item::SAND) {
foreach ($this->growids as $index => $growid) {
if ($itemid == $growid) {
$this->farmdata[$block->x . "." . $block->y . "." . $block->z]['id'] = $this->blockids[$index];
$this->farmdata[$block->x . "." . $block->y . "." . $block->z]['damage'] = 0;
$this->farmdata[$block->x . "." . $block->y . "." . $block->z]['time'] = $this->configdata["growing-time"];
break;
}
}
}
}
示例2: onBlock
public function onBlock(PlayerInteractEvent $event)
{
if (!$event->getPlayer()->hasPermission("Farms") and !$event->getPlayer()->hasPermission("Farms.VIP")) {
return;
}
$block = $event->getBlock()->getSide(1);
// Cocoa been
if ($event->getItem()->getId() == Item::DYE and $event->getItem()->getDamage() == 3) {
$tree = $event->getBlock()->getSide($event->getFace());
// Jungle wood
if ($tree->getId() == Block::WOOD and $tree->getDamage() == 3) {
$event->getBlock()->getLevel()->setBlock($event->getBlock()->getSide($event->getFace()), new CocoaBeanBlock($event->getFace()), true, true);
return;
}
}
// Farmland or sand
if ($event->getBlock()->getId() == Item::FARMLAND or $event->getBlock()->getId() == Item::SAND) {
foreach ($this->crops as $crop) {
if ($event->getItem()->getId() == $crop["item"]) {
$key = $block->x . "." . $block->y . "." . $block->z;
$this->farmData[$key]['id'] = $crop["block"];
$this->farmData[$key]['damage'] = 0;
$this->farmData[$key]['level'] = $block->getLevel()->getFolderName();
$this->farmData[$key]['time'] = $this->makeTimestamp(date("Y-m-d H:i:s"));
$this->farmData[$key]['growtime'] = $this->speedData[$event->getPlayer()->hasPermission("Farms.VIP") ? "vip-growing-time" : "growing-time"];
break;
}
}
}
}
示例3: onPlayerInteract
public function onPlayerInteract(PlayerInteractEvent $event)
{
$i = $event->getItem();
$b = $event->getBlock();
$p = $event->getPlayer();
if ($b->getID() == 17 && $b->getDamage() == 3) {
if ($i->getID() == 351 && $i->getDamage() == 3) {
$f = $event->getFace();
if ($b->getSide($f)->getID() !== 0) {
return;
}
switch ($f) {
case 2:
$meta = 0;
break;
case 3:
$meta = 2;
break;
case 4:
$meta = 3;
break;
case 5:
$meta = 1;
break;
}
if (!isset($meta)) {
return;
}
$this->beanPlace($b->getSide($f), $meta);
if (!$p->isCreative()) {
$i = $p->getInventory()->getItemInHand();
$i->setCount($i->getCount() - 1);
$inv = $p->getInventory();
$inv->setItem($inv->getHeldItemSlot(), $i);
}
}
} elseif ($b->getID() == 127) {
if (!isset($this->grow[$this->getPos($b)])) {
$this->beanPlace($b, $b->getDamage());
}
if ($i->getID() == 351 && $i->getDamage() == 15) {
$this->beanGrow($b, true);
if (!$p->isCreative()) {
$i = $p->getInventory()->getItemInHand();
$i->setCount($i->getCount() - 1);
$inv = $p->getInventory();
$inv->setItem($inv->getHeldItemSlot(), $i);
}
}
}
}
示例4: onPlayerInteract
public function onPlayerInteract(PlayerInteractEvent $e)
{
$pl = $e->getPlayer();
$hand = $pl->getInventory()->getItemInHand();
if ($hand->getId() != Item::SPAWN_EGG) {
return;
}
$bl = $e->getBlock();
if (!$bl->isSolid()) {
return;
}
$bl = $bl->getSide($e->getFace());
if ($hand->getDamage() == Wolf::NETWORK_ID) {
$this->spawner[implode(",", [$bl->getX(), $bl->getY(), $bl->getZ()])] = [$pl->getName(), $hand->getDamage(), time()];
}
}
示例5: PlayerInteractEvent
public function PlayerInteractEvent(PlayerInteractEvent $ev)
{
$item = $ev->getItem();
$block = $ev->getBlock();
$player = $ev->getPlayer();
if ($ev->getAction() == PlayerInteractEvent::RIGHT_CLICK_BLOCK && $ev->getFace() !== 255) {
if ($player->hasPermission("worldedit.command.setpos2") && $item->getID() == $this->getData("tool-id", Item::IRON_HOE)) {
$player->sendMessage("[WorldEditor]Pos2 지점을 선택했어요 ({$block->x}, {$block->y}, {$block->z})");
self::$pos[$player->getName()][1] = $block->floor();
$ev->setCancelled();
return;
}
} elseif ($ev->getAction() == PlayerInteractEvent::LEFT_CLICK_AIR && $player->hasPermission("worldedit.command.setpos1") && $item->getID() == $this->getData("tool-id", Item::IRON_HOE)) {
$player->sendMessage("[WorldEditor]Pos1 지점을 선택했어요 ({$block->x}, {$block->y}, {$block->z})");
self::$pos[$player->getName()][0] = $block->floor();
return;
}
}
示例6: onPlayerInteract
public function onPlayerInteract(PlayerInteractEvent $event)
{
$b = $event->getBlock();
if ($b->getID() !== 20) {
$b = $b->getSide($event->getFace());
}
$p = $event->getPlayer();
$n = $p->getName();
$t = $this->touch;
$ic = $this->ic;
$m = "[ItemCase] ";
$ik = $this->isKorean();
if (isset($t[$n])) {
$pos = $this->getPos($b);
$tc = $t[$n];
switch ($tc["Type"]) {
case "Add":
if (!$this->addCase($pos, $tc["Item"], $tc["Size"])) {
$m .= $ik ? "이미 3개가 존재합니다." : "Already 3 ItemCase Here";
} else {
$m .= ($ik ? "아이템케이스가 생성되었습니다." : "ItemCase Create") . " [{$pos}]";
}
unset($t[$n]);
break;
case "Del":
if (!isset($ic[$pos])) {
$m .= $ik ? "이곳에는 아이템 케이스가 없습니다." : "ItemCase is not exist here";
} else {
$m .= ($ik ? "아이템케이스가 제거되었습니다." : "ItemCase is Delete ") . "[{$pos}]";
$this->delCase($pos);
unset($t[$n]);
}
break;
}
$this->touch = $t;
$this->spawnCase();
if (isset($m)) {
$p->sendMessage($m);
}
$event->setCancelled();
if ($event->getItem()->isPlaceable()) {
$this->place[$p->getName()] = true;
}
} else {
$this->onBlockEvent($event, true);
}
}
示例7: onPlayerInteract
public function onPlayerInteract(\pocketmine\event\player\PlayerInteractEvent $event)
{
$block = $event->getBlock();
if ($block->getID() !== 20) {
$block = $block->getSide($event->getFace());
}
$player = $event->getPlayer();
if (isset($this->editors[$name = $player->getName()])) {
return false;
}
$t = $this->touch;
$sh = $this->sh;
$ik = $this->isKorean();
$pos = $this->getPos($block);
if (isset($t[$name])) {
switch ($t[$name]["Type"]) {
case "Add":
$this->addShop($pos, $t[$name]["Mode"] == self::BUY ? "Buy" : "Sell", $t[$name]["Item"], $t[$name]["Count"], $t[$name]["Price"]);
$player->sendMessage(Color::YELLOW . "[Shop] " . ($ik ? "상점이 생성되었습니다." : "Shop Create"));
unset($t[$name]);
break;
case "Change":
if (!isset($sh[$pos])) {
$player->sendMessage(Color::RED . "[Shop] " . ($ik ? "이곳에는 상점이 없습니다." : "Shop is not exist here"));
} else {
$this->removeShop($pos);
$this->addShop($pos, $t[$name]["Mode"] == self::BUY ? "Buy" : "Sell", $t[$name]["Item"], $t[$name]["Count"], $t[$name]["Price"]);
$player->sendMessage(Color::YELLOW . "[Shop] " . ($ik ? "상점이 변경되었습니다." : "Shop Changed"));
unset($t[$name]);
}
break;
case "Del":
if (!isset($sh[$pos])) {
$player->sendMessage(Color::RED . "[Shop] " . ($ik ? "이곳에는 상점이 없습니다." : "Shop is not exist here"));
} else {
$this->removeShop($pos);
$player->sendMessage(Color::YELLOW . "[Shop] " . ($ik ? "상점이 제거되었습니다." : "Shop is Delete"));
unset($t[$name]);
}
break;
case "DelMode":
if (!isset($sh[$pos])) {
$player->sendMessage(Color::RED . "[Shop] " . ($ik ? "이곳에는 상점이 없습니다." : "Shop is not exist here"));
} else {
$this->removeShop($pos);
$player->sendMessage(Color::YELLOW . "[Shop] " . ($ik ? "[제거모드] 상점이 제거되었습니다." : "[DelMode] Shop is Delete"));
}
break;
}
$this->touch = $t;
} elseif (isset($sh[$pos])) {
$shop = $sh[$pos];
if ($player->isCreative()) {
$player->sendMessage(Color::RED . "[Shop] " . ($ik ? " 당신은 크리에이티브입니다.\n" . Color::RED . "[{$shop['0']}] 상점정보 : [구매] 아이디: {$shop['1']} (갯수 : {$shop['2']}) 가격 : {$shop['3']} 원" : " You are Creative mode\n" . Color::RED . "[Shop] StoreInfo : [{$shop['0']}] ID: {$shop['1']} (Count: {$shop['2']}) Price: {$shop['3']} \$"));
} else {
$tap = $this->tap;
$item = Item::fromString($shop[1]);
$item->setCount($shop[2]);
if (!isset($tap[$name]) || $tap[$name][1] !== $pos) {
$tap[$name] = [0, $pos];
}
$player->getLevel()->addSound(new \pocketmine\level\sound\ClickSound($block), [$player]);
switch ($shop[0]) {
case "Buy":
if (microtime(true) - $tap[$name][0] > 0) {
$player->sendMessage(Color::YELLOW . "[Shop] " . ($ik ? "구매하시려면 다시한번눌러주세요.\n" . Color::YELLOW . " [Shop] 상점정보 : [구매] 아이디: {$shop['1']} (갯수 : {$shop['2']}) 가격 : {$shop['3']} 원" : "If you want to buy, One more touch block\n" . Color::YELLOW . " [Shop] StoreInfo : [Buy] ID: {$shop['1']} (Count: {$shop['2']}) Price: {$shop['3']} \$"));
} elseif (($money = $this->getMoney($player)) < $shop[3]) {
$player->sendMessage(Color::RED . "[Shop] " . ($ik ? "돈이 부족합니다. \n" . Color::YELLOW . "[Shop] 나의돈 : {$money} 원" : "You has less money than its price \n" . Color::YELLOW . "[Shop] Your money : {$money} \$"));
} else {
$player->getInventory()->addItem($item);
$this->giveMoney($player, -$shop[3]);
$player->sendMessage(Color::YELLOW . "[Shop] " . ($ik ? "아이템을 구매하셨습니다. 아이디 : {$shop['1']} (갯수 : {$shop['2']}) 가격 : {$shop['3']} 원\n" . Color::YELLOW . " [Shop] 나의 돈: " . $this->getMoney($player) . " \$" : "You buy Item. ID: {$shop['1']} (Count: {$shop['2']}) Price: {$shop['3']} \$\n" . Color::YELLOW . " [Shop] Your money: " . $this->getMoney($player) . " \$"));
}
break;
case "Sell":
if (microtime(true) - $tap[$name][0] > 0) {
$player->sendMessage(Color::YELLOW . "[Shop] " . ($ik ? "판매하시려면 다시한번눌러주세요.\n" . Color::YELLOW . " [Shop] 상점정보 : [판매] 아이디: {$shop['1']} (갯수 : {$shop['2']}) 가격 : {$shop['3']} 원" : "If you want to sell, One more touch block\n" . Color::YELLOW . " [Shop] StoreInfo : [Sell] ID: {$shop['1']} (Count: {$shop['2']}) Price: {$shop['3']} \$"));
} else {
$count = 0;
foreach ($player->getInventory()->getContents() as $ii) {
if ($item->equals($ii, true)) {
$count += $ii->getCount();
}
}
if ($count < $shop[2]) {
$player->sendMessage(Color::RED . "[Shop] " . ($ik ? "아이템이 부족합니다.\n" . Color::RED . " [Shop] 소유갯수 : " : "You has less Item than its count\n" . Color::RED . " [Shop] Your have : ") . $count);
} else {
$player->getInventory()->removeItem($item);
$this->giveMoney($player, $shop[3]);
$player->sendMessage(Color::YELLOW . "[Shop] " . ($ik ? "아이템을 판매하셨습니다. 아이디 : {$shop['1']} (갯수 : {$shop['2']}) 가격 : {$shop['3']} 원\n" . Color::YELLOW . " [Shop] 나의 돈 : " . $this->getMoney($player) . " \$" : "You sell Item. ID: {$shop['1']} (Count: {$shop['2']}) Price: {$shop['3']} \$\n" . Color::YELLOW . " [Shop] Your money: " . $this->getMoney($player) . " \$"));
}
}
break;
}
$this->tap[$name] = [microtime(true) + 1, $pos];
}
$event->setCancelled();
if ($event->getItem()->isPlaceable()) {
$this->place[$name] = true;
}
//.........这里部分代码省略.........
示例8: onPlayerInteract
public function onPlayerInteract(PlayerInteractEvent $event)
{
$b = $event->getBlock();
if ($b->getID() !== 20) {
$b = $b->getSide($event->getFace());
}
$p = $event->getPlayer();
$n = $p->getName();
$t = $this->touch;
$sh = $this->sh;
$m = "[Shop] ";
$ik = $this->isKorean();
$pos = $this->getPos($b);
if (isset($t[$n])) {
$tc = $t[$n];
switch ($tc["Type"]) {
case "Add":
$this->addShop($pos, $tc["Mode"], $tc["Item"], $tc["Count"], $tc["Price"]);
$m .= $ik ? "상점이 생성되었습니다." : "Shop Create";
unset($t[$n]);
break;
case "Del":
if (!isset($sh[$pos])) {
$m .= $ik ? "이곳에는 상점이 없습니다." : "Shop is not exist here";
} else {
$this->delShop($pos);
$m .= $ik ? "상점이 제거되었습니다." : "Shop is Delete ";
unset($t[$n]);
}
break;
}
$this->touch = $t;
} elseif (isset($sh[$pos])) {
if ($p->getGamemode() == 1) {
$m .= $ik ? " 당신은 크리에이티브입니다." : " You - Creative mode";
} else {
$tap = $this->tap;
$money = $this->money;
$s = $sh[$pos];
$i = Item::fromString($s[1]);
$i->setCount($s[2]);
$pr = $s[3];
if (!isset($tap[$n]) || $tap[$n][1] !== $pos) {
$tap[$n] = [0, $pos];
}
$c = microtime(true) - $tap[$n][0];
$inv = $p->getInventory();
switch ($s[0]) {
case "Buy":
if ($c > 0) {
$m .= $ik ? "구매하시려면 다시한번눌러주세요. \n 상점정보 : [구매] 아이디: {$s['1']} (갯수 : {$s['2']}) 가격 : {$pr} 원" : "If you want to buy, One more touch block \n StoreInfo : [Buy] ID: {$s['1']} (Count: {$s['2']}) Price: {$pr} \$";
} elseif (!$money->hasMoney($n, $pr)) {
$m .= $ik ? "돈이 부족합니다. \n 나의돈 : " . $money->getMoney($n) . " 원" : "You has less money than its price \nYour money : " . $money->getMoney($n) . "\$";
} else {
$inv->addItem($i);
$this->giveMoney($p, -$pr);
$m .= $ik ? "아이템을 구매하셨습니다. 아이디 : {$s['1']} (갯수 : {$s['2']}) 가격 : {$pr} 원 \n 나의 돈:" . $this->getMoney($p) . "\$" : "You buy Item. ID: {$s['1']} (Count: {$s['2']}) Price: {$pr} \$ \n Your money:" . $this->getMoney($p) . "\$";
}
break;
case "Sell":
if ($c > 0) {
$m .= $ik ? "판매하시려면 다시한번눌러주세요. \n 상점정보 : [판매] 아이디: {$s['1']} (갯수 : {$s['2']}) 가격 : {$pr} 원" : "If you want to sell, One more touch block \n StoreInfo : [Sell] ID: {$s['1']} (Count: {$s['2']}) Price: {$pr} \$";
} else {
$cnt = 0;
foreach ($inv->getContents() as $ii) {
if ($i->equals($ii, true)) {
$cnt += $ii->getCount();
}
}
if ($cnt < $i->getCount()) {
$m .= ($ik ? "아이템이 부족합니다. \n 소유갯수 : " : "You has less Item than its count \n Your have : ") . $cnt;
} else {
$inv->removeItem($i, $p);
$this->giveMoney($p, $pr);
$m .= $ik ? "아이템을 판매하셨습니다. 아이디 : {$s['1']} (갯수 : {$s['2']}) 가격 : {$pr} 원 \n 나의 돈 :" . $this->getMoney($p) . "\$" : "You sell Item. ID: {$s['1']} (Count: {$s['2']}) Price: {$pr} \$ \n Your money:" . $this->getMoney($p) . "\$";
}
}
break;
}
$inv->sendContents($p);
$this->tap[$n] = [microtime(true) + 1, $pos];
}
} else {
return;
}
if (isset($m)) {
$p->sendMessage($m);
}
$event->setCancelled();
if ($event->getItem()->isPlaceable()) {
$this->place[$p->getName()] = true;
}
$this->onBlockEvent($event, true);
}
示例9: onPlayerBlockTouch
public function onPlayerBlockTouch(PlayerInteractEvent $event)
{
$Player = $event->getPlayer();
$Level = $Player->getLevel();
$Item = $event->getItem();
if (!$this->plugin->game || $this->plugin->game->level_name != $Level->getFolderName()) {
return;
}
if ($Item->getId() == 259) {
$event->setCancelled(true);
return;
}
if ($event->getFace() == 255) {
$Inv = $Player->getInventory();
$ID = $Item->getId();
if ($ID >= 298 && $ID <= 314) {
$ID = ($ID - 298) % 4;
$Armor = $Inv->getArmorItem($ID);
$Inv->setArmorItem($ID, $Item);
$Inv->setItemInHand($Armor);
} elseif ($ID == 37) {
$this->plugin->game->PopupInfo2->PlayersData[strtolower($Player->getName())][1] += 50;
$ItemInHand = $Inv->getItemInHand();
$ItemInHand->setCount($ItemInHand->getCount() - 1);
$Inv->setItemInHand($ItemInHand);
} elseif ($ID == 38) {
$this->plugin->game->PopupInfo2->PlayersData[strtolower($Player->getName())][1] += 100;
$ItemInHand = $Inv->getItemInHand();
$ItemInHand->setCount($ItemInHand->getCount() - 1);
$Inv->setItemInHand($ItemInHand);
} elseif ($ID == 345) {
if ($Team = $this->plugin->game->getTeamByPlayer($Player)) {
$this->plugin->setState("teleport", $Player, false);
$Player->teleport($Team->Spawn);
$ItemInHand = $Inv->getItemInHand();
$ItemInHand->setCount($ItemInHand->getCount() - 1);
$Inv->setItemInHand($ItemInHand);
}
}
return;
}
$Block = $event->getBlock();
if ($Block->getId() == 68) {
$event->setCancelled($this->plugin->game->SignClick($Block->getX(), $Block->getY(), $Block->getZ(), $event->getPlayer()));
} else {
$event->setCancelled($this->plugin->game->BlockClick($Block->getX(), $Block->getY(), $Block->getZ(), $Block, $Player));
}
}
示例10: onPlayerInteractEvent
public function onPlayerInteractEvent(PlayerInteractEvent $event)
{
if ($event->getItem()->getId() == Item::FLINT_AND_STEEL and $event->getFace() == 1) {
if ($event->getBlock() instanceof Block and $event->getBlock()->getId() == Block::OBSIDIAN) {
$twoPos = $this->canActivate($event->getBlock()->getLevel(), $event->getBlock());
if ($twoPos !== false) {
$this->setPortal($event->getBlock()->getLevel(), $twoPos);
$event->setCancelled();
}
}
}
}
示例11: PlayerInteractEvent
public function PlayerInteractEvent(PlayerInteractEvent $ev)
{
if ($ev->getFace() == 255 || $ev->getAction() != PlayerInteractEvent::RIGHT_CLICK_BLOCK) {
return;
}
$item = $ev->getItem();
$player = $ev->getPlayer();
$pos = $ev->getBlock()->getSide($ev->getFace());
if ($item->getId() === Item::SPAWN_EGG) {
$entity = self::create($item->getDamage(), $pos);
if ($entity != null) {
$entity->spawnToAll();
}
if ($player->isSurvival()) {
$item->count--;
$player->getInventory()->setItemInHand($item);
}
$ev->setCancelled();
} elseif ($item->getId() === Item::MONSTER_SPAWNER) {
self::$spawn["{$pos->x}:{$pos->y}:{$pos->z}:{$pos->level->getFolderName()}"] = ["radius" => 5, "mob-list" => ["Cow", "Pig", "Sheep", "Chicken", "Zombie", "Creeper", "Skeleton", "Spider", "PigZombie", "Enderman"]];
}
}
示例12: onTouchBlock
/**
* @param PlayerInteractEvent $event
* @priority HIGHEST
*/
public function onTouchBlock(PlayerInteractEvent $event)
{
$player = $event->getPlayer();
$session = $this->getMain()->getSessions()->getSession($player);
if (!$session instanceof Session or !$session->inSession($this)) {
return;
}
$event->setCancelled($event->getFace() !== 0xff);
if ($event->getFace() === 0xff) {
return;
}
Settings::spleef_getType($event->getBlock(), $arenaId, $spectator);
if ($arenaId !== -1) {
$data = $this->getPlayerData($session);
if ($data->isInArena()) {
$this->rebouncePlayer($data);
return;
}
$arena = $this->getArena($arenaId);
if ($spectator === 2) {
$arena->kick($data, "Spectator quit", false);
} elseif ($spectator === 1) {
$arena->spectate($this->getPlayerData($session));
} else {
if ($arena->isPlaying()) {
$session->tell("A match is going on in {$arena}!");
return;
}
if ($arena->isFull()) {
$session->tell("The arena is already full!");
return;
}
$arena->join($data);
}
} else {
$data = $this->getPlayerData($session);
if ($data->isPlaying() and $data->getArena()->isPlaying() and Settings::spleef_isArenaFloor($event->getBlock())) {
$event->setCancelled(false);
} elseif ($result = Settings::spleef_incineratorInfo($event->getBlock())) {
if ($event->getItem()->getId() !== Item::AIR) {
$event->setCancelled();
$item = $event->getItem();
$player->getInventory()->setItemInHand(Item::get(Item::AIR, 0, 1));
$player->getInventory()->sendContents($player->getInventory()->getViewers());
for ($x = 936; $x <= 938; $x++) {
$this->spleefWorld->setBlock(new Vector3($x, 21, -13), Block::get(Block::JACK_O_LANTERN), false, false);
}
for ($z = -16; $z <= -14; $z++) {
$this->spleefWorld->setBlock(new Vector3(935, 21, $z), Block::get(Block::JACK_O_LANTERN, 1), false, false);
}
$motion = $result[0]->subtract($player)->multiply(0.3);
$source = $player->add(0, 1.3);
$itemEntity = Entity::createEntity("Item", $player->getLevel()->getChunk($source->getX() >> 4, $source->getZ() >> 4), new Compound("", ["Pos" => new Enum("Pos", [new Double("", $source->getX()), new Double("", $source->getY()), new Double("", $source->getZ())]), "Motion" => new Enum("Motion", [new Double("", $motion->x), new Double("", $motion->y), new Double("", $motion->z)]), "Rotation" => new Enum("Rotation", [new Float("", lcg_value() * 360), new Float("", 0)]), "Health" => new Short("Health", 1), "Item" => new Compound("Item", ["id" => new Short("id", $item->getId()), "Damage" => new Short("Damage", $item->getDamage()), "Count" => new Byte("Count", $item->getCount())]), "PickupDelay" => new Short("PickupDelay", 0x7fff)]));
$itemEntity->spawnToAll();
$this->getMain()->getServer()->getScheduler()->scheduleDelayedTask(new CallbackPluginTask($this->getMain(), function (\pocketmine\entity\Item $item, Vector3 $pos) {
$item->teleport($pos);
}, $itemEntity, $result[0]), 10);
$this->getMain()->getServer()->getScheduler()->scheduleDelayedTask(new CallbackPluginTask($this->getMain(), function (\pocketmine\entity\Item $item, Vector3 $target) {
$item->setMotion($target->subtract($item)->multiply(0.1));
}, $itemEntity, $result[1]), 40);
$this->getMain()->getServer()->getScheduler()->scheduleDelayedTask(new CallbackPluginTask($this->getMain(), function (\pocketmine\entity\Item $item) {
$item->kill();
}, $itemEntity), 70);
$this->getMain()->getServer()->getScheduler()->scheduleDelayedTask(new CallbackPluginTask($this->getMain(), function () {
for ($x = 936; $x <= 938; $x++) {
$this->spleefWorld->setBlock(new Vector3($x, 21, -13), Block::get(Block::PUMPKIN), false, false);
}
for ($z = -16; $z <= -14; $z++) {
$this->spleefWorld->setBlock(new Vector3(935, 21, $z), Block::get(Block::PUMPKIN, 1), false, false);
}
}), 80);
}
}
}
}