Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Spawn mob help

Comments in 'Plugin Development' started by BalAnce, Jul 27, 2015.

  1. BalAnce
    Offline

    BalAnce Active Member

    Joined:
    Mar 10, 2015
    Posts:
    125
    Minecraft User:
    BalAnce
    PHP:
    public function spawnMob(Position $pos){
            
    $nbt =  new Compound("",[
                new 
    Enum("Pos",[
                    new 
    Double("",$pos->getX()),
                    new 
    Double("",$pos->getY()),
                    new 
    Double("",$pos->getZ()),
                    ]),
                new 
    Enum("Motion", [
                    new 
    Double("",0.0),
                    new 
    Double("",0.0),
                    new 
    Double("",0.0),
                    ]),
                new 
    Enum("Rotation", [
                    new 
    Float(""lcg_value() * 360),
                    new 
    Float("",0),
                    ])
                ]);
            
    $ent Entity::createEntity(new Cow($pos->getLevel()->getChunk($pos->getX() >> 4$pos->getZ() >> 4), $nbt));
            
    $ent->spawnToAll();
            echo 
    "Ran!";
            return 
    $ent->getId();
        }
    trying to spawn a cow as test using code abaove ^

    it gives me error on console and crashes server

    Code:
    Fatal error: Class pocketmine\entity\Cow contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (pocketmine\entity\Living::getName) in phar:///Users/newuser/Desktop/Pocketmine/PocketMine-MP.phar/src/pocketmine/entity/Cow.php on line 27
  2. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
  3. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    PHP:
    $entity Entity::createEntity('Cow'$chunk$nbt); // Try
    BalAnce likes this.
  4. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Actually can you spawn cows?
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    The PocketMine cow class is deformed and shall not be used.

Share This Page

Advertisement