case 3; $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("", -sin($player->yaw / 180 * M_PI) * cos($player->pitch / 180 * M_PI)), new DoubleTag("", -sin($player->pitch / 180 * M_PI)), new DoubleTag("", cos($player->yaw / 180 * M_PI) * cos($player->pitch / 180 * M_PI)) ]), "Rotation" => new ListTag("Rotation", [ new FloatTag("", $player->yaw), new FloatTag("", $player->pitch) ]), ]); $f = 2; $snowball = Entity::createEntity("Snowball", $nbt, $player->chunk, $player); it say [22:23:13] [Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'Core v2': Argument 2 passed to pocketmine\entity\Entity::createEntity() must be an instance of pocketmine\level\Level, instance of pocketmine\nbt\tag\CompoundTag given, called in C:\Users\uzivatel\Desktop\Server\plugins\Core\src\Core\Core.php on line 756 on Core\Core [22:23:13] [Server thread/CRITICAL]: TypeError: "Argument 2 passed to pocketmine\entity\Entity::createEntity() must be an instance of pocketmine\level\Level, instance of pocketmine\nbt\tag\CompoundTag given, called in C:\Users\uzivatel\Desktop\Server\plugins\Core\src\Core\Core.php on line 756" (EXCEPTION) in "/src/pocketmine/entity/Entity" at line 619 line 756 is $snowball = Entity::createEntity("Snowball", $nbt, $player->chunk, $player);
PHP: case 3;$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("", -sin($player->yaw / 180 * M_PI) * cos($player->pitch / 180 * M_PI)),new DoubleTag("", -sin($player->pitch / 180 * M_PI)),new DoubleTag("", cos($player->yaw / 180 * M_PI) * cos($player->pitch / 180 * M_PI))]),"Rotation" => new ListTag("Rotation", [new FloatTag("", $player->yaw),new FloatTag("", $player->pitch)]),]);$f = 2;$snowball = Entity::createEntity("Snowball", $nbt, $player->chunk, $player);$snowball->setMotion($snowball->getMotion()->multiply($f));
Try take a look at this: https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/Player.php#L2118