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

What should i do to spawn Entity whit asVector3? 1.2

Discussion in 'Development' started by LewBr, Sep 26, 2017.

  1. LewBr

    LewBr Zombie

    Messages:
    385
    GitHub:
    lewbr
    My code doesn't works in Pocketmine 1.2 ALPHA8
    i need to spawn in the same coordinates of x,y,z that is in $pk, please help
    CODE:
    PHP:
                $entityId5 20005;
                
    $pk5 = new AddEntityPacket();
                
    $pk5->type ItemEntity::NETWORK_ID;
                
    $pk5->username "";
                
    $pk5->entityRuntimeId $entityId5;
                
    $pk5->eid $entityId5
                
    $pk5->= -332//COORDINATS
                
    $pk5->35//COORDINATS
                
    $pk5->1306//COORDINATS
                
    $pk5->speedX $pk5->speedY $pk5->speedZ 0.0;
                
    $pk5->yaw 0;
                
    $pk5->pitch 0;
                
    $flags = (
                    (
    << Entity::DATA_FLAG_CAN_SHOW_NAMETAG) |
                    (
    << Entity::DATA_FLAG_ALWAYS_SHOW_NAMETAG) |
                    (
    << Entity::DATA_FLAG_IMMOBILE)
                );
                
    $pk5->metadata = [
                    
    Entity::DATA_FLAGS => [Entity::DATA_TYPE_LONG$flags],
                    
    Entity::DATA_NAMETAG => [Entity::DATA_TYPE_STRING"...."],
                ];
                
    $p->dataPacket($pk5);
     
  2. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
  3. Jack Noordhuis

    Jack Noordhuis Zombie Pigman Poggit Reviewer

    Messages:
    618
    GitHub:
    JackNoordhuis
    $pk->position and optionally, $pk->motion, need to be an instance of pocketmine\math\Vector3.
    PHP:
    $pk->position = new pocketmine\math\Vector3(-332351306);
    $pk->motion = new pocketmine\math\Vector3(000); // optional
     
    Last edited: Sep 26, 2017
    LewBr and jasonwynn10 like 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.