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

Create a Cow (mööö)

Discussion in 'Plugin Help' started by ihs4ncim, Apr 9, 2022.

  1. ihs4ncim

    ihs4ncim Silverfish

    Messages:
    16
    GitHub:
    ihs4ncim
    hey, whats up? I want create a Cow. This method worked when using PM3, but don't working now.
     
  2. ihs4ncim

    ihs4ncim Silverfish

    Messages:
    16
    GitHub:
    ihs4ncim
    PHP:
    $nbt Entity::createBaseNBT($level->getSafeSpawn(), null22);
    $npc = new Cow("Cow"$level$nbt);
    $npc->spawnToAll();
     
  3. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Look at how PocketMine does it!

    PHP:
    //from Bow.php
    $entity = new ArrowEntity(Location::fromObject(
         
    $player->getEyePos(),
         
    $player->getWorld(),
         (
    $location->yaw 180 360 0) - $location->yaw,
         -
    $location->pitch
    ), $player$baseForce >= 1);

    $entity->spawnToAll();
    https://github.com/pmmp/PocketMine-MP/blob/stable/src/item/Bow.php
     
  4. Superomarking

    Superomarking Spider Jockey

    Messages:
    34
    GitHub:
    Superomarking
    Don't do that, Use
    PHP:
    new Cow(Location);
    What you provided should only be used on projectiles.
     
    minijaham likes this.
  5. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Location::fromObject still returns Location. I provided that code for reference.
     
  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.