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

Animal spawning

Discussion in 'Development' started by Robertcc19, Dec 28, 2016.

  1. Robertcc19

    Robertcc19 Silverfish

    Messages:
    18
    I would like to get the animal spawn feature working, where should I start?

    Is it already supported, or do I have to start from scratch?
     
  2. kaliiks

    kaliiks Zombie

    Messages:
    250
    PHP:
    $nbt = new CompoundTag ("", [
                                
    "Pos" => new ListTag"Pos", [
                                    new 
    DoubleTag(""$player->x),
                                    new 
    DoubleTag(""$player->),
                                    new 
    DoubleTag(""$player->z)
                                ]),
                                
    "Motion" => new ListTag "Motion", [
                                    new 
    DoubleTag(""0),
                                    new 
    DoubleTag(""0),
                                    new 
    DoubleTag(""0)
                                ]),
                                
    "Rotation" => new ListTag("Rotation", [
                                    new 
    FloatTag(""90),
                                    new 
    FloatTag(""90)
                                ])
                            ]);
                            
    $youranimal Entity::createEntity(Pig::NETWORK_ID$player->chunk$nbt);
                            
    $youranimal->spawnToAll();
                        }
    This spawn pig
    and dont forget to use
    PHP:
    use pocketmine\entity\Entity;
    use 
    pocketmine\nbt\tag\IntTag;
    use 
    pocketmine\nbt\tag\ByteTag;
    use 
    pocketmine\nbt\tag\StringTag;
    use 
    pocketmine\nbt\tag\DoubleTag;
    use 
    pocketmine\nbt\tag\CompoundTag;
    use 
    pocketmine\nbt\tag\ListTag;
    use 
    pocketmine\nbt\tag\FloatTag;
     
    Diduhless likes this.
  3. Robertcc19

    Robertcc19 Silverfish

    Messages:
    18
    Anyone have a solid tutorial on where to start with plugins for Pocketmine? I tried the one on github but I only got as far as setting up the folder structure and plugin.yml, it appears to be a little dated
     
  4. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    But you have to learn php first
     
  5. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    and lets not forget OOP
     
  6. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    1. Learn general Programming, stuff about computers //Most ppl know this already
    2. Learn OOP //Wikipedia or php.net reading and understanding up to 1 hour
    3. Learn PHP //php.net or sites like code academy
    4. Read pocketmine source code start from PocketMine.php [For quick starters: Start from /pocketmine/plugin]
     
    Muqsit, Robertcc19 and HimbeersaftLP like this.
  7. Robertcc19

    Robertcc19 Silverfish

    Messages:
    18
    I know PHP and OPP, I am running into an issue with the use pocketmine\event\plugin\PluginBase part of the tutorial as that file does not seem to exist
     
  8. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    Remove the \event.
     
  9. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    PHP and OOP aren't the only things you need to learn to make a PocketMine plugin.
    #readTheOutdatedDocs
     
    Sandertv and Primus like this.
  10. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    If you have done step 1, 2 and 3 then please do step 4. You can also generate phpdocs for you if you prefer that.
     
    Robertcc19 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.