1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

error createEntity

Discussion in 'Development' started by kaliiks, Feb 25, 2017.

  1. kaliiks

    kaliiks Zombie

    Messages:
    250
    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);
     
  2. SavionLegendZzz

    SavionLegendZzz Slime

    Messages:
    75
    GitHub:
    savionlegends
    use
    PHP:
    please
     
    kaliiks likes this.
  3. BEcraft

    BEcraft Slime

    Messages:
    79
    GitHub:
    BEcraft
    Maybe?
    PHP:
    $snowball Entity::createEntity("Snowball"$player->chunk,  $nbt$player);
     
  4. MyNET

    MyNET Silverfish

    Messages:
    24
    please show up full of your code
     
  5. kaliiks

    kaliiks Zombie

    Messages:
    250
    PHP:
    case 3;
    $nbt = new CompoundTag("", [
    "Pos" => new ListTag("Pos", [
    new 
    DoubleTag(""$player->x),
    new 
    DoubleTag(""$player->$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));
     
    Last edited: Feb 26, 2017
  6. kaliiks

    kaliiks Zombie

    Messages:
    250
    No
     
  7. kaliiks

    kaliiks Zombie

    Messages:
    250
    In oldest pm it was working good..
     
  8. BEcraft

    BEcraft Slime

    Messages:
    79
    GitHub:
    BEcraft
  9. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    PHP:
    $snowball Entity::createEntity("Snowball"$player->getLevel(), $nbt$player);
     
  10. kaliiks

    kaliiks Zombie

    Messages:
    250
    Nice, thx!
     
    Muqsit likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.