spawnToAll error

Discussion in 'Development' started by TheWalkingDrift, Sep 12, 2019 at 6:55 PM.

  1. TheWalkingDrift

    TheWalkingDrift Silverfish

    Messages:
    23
    This is my code:

    $player = $sender;
    $sender->sendMessage("Spawned a Cow");
    $nbt = new CompoundTag("", [
    "Pos" => new ListTag("Pos", [
    new DoubleTag("", $player->x),
    new DoubleTag("", $player->y),
    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)
    ]),
    ]);

    $entity = Entity::createEntity("Cow", $player->getLevel(), $nbt, $player);

    $entity->spawnToAll();



    And this is the error:

    Call to a meber function spawnToAll() on null
     
  2. TheWalkingDrift

    TheWalkingDrift Silverfish

    Messages:
    23
    Do you know where my misstake is ?
     
  3. HimbeersaftLP

    HimbeersaftLP Chicken

    Messages:
    1,687
    GitHub:
    HimbeersaftLP
  4. TheWalkingDrift

    TheWalkingDrift Silverfish

    Messages:
    23
    Can you give me a example ?
     
  5. TheWalkingDrift

    TheWalkingDrift Silverfish

    Messages:
    23
    There is an new error:
    Call to a meber function register() on null
     
  6. TheWalkingDrift

    TheWalkingDrift Silverfish

    Messages:
    23

Share This Page

  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.