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

What are the new SetEntityLinkPacket's "type" constants?

Discussion in 'Facepalm' started by instantlyta, Jun 13, 2017.

  1. instantlyta

    instantlyta Slime

    Messages:
    96
    GitHub:
    intagaming
    What are the new SetEntityLinkPacket's "type" constants?
    P/s: I'm trying to fix PmChair.. My code is the latest code from the github repo.
     
  2. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    The types are still exactly the same, they didn't change. If you fix up the other issues it should work just fine.
     
    jojoe77777 likes this.
  3. instantlyta

    instantlyta Slime

    Messages:
    96
    GitHub:
    intagaming
    The "type" of the SetEntityLinkPacket in PmChair is "true", which means it is not the same type as "byte", or "integer". The error:
    Code:
    [Server thread/CRITICAL]: TypeError: "Argument 1 passed to pocketmine\utils\BinaryStream::putByte() must be of the type integer, boolean given
     
  4. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    From my experience type number 2 is sitting down, and 3 is standing up again. Though, 0 might work for three too. I haven't really investigated that.
     
    jojoe77777 likes this.
  5. instantlyta

    instantlyta Slime

    Messages:
    96
    GitHub:
    intagaming
    I may put the code here, so maybe someone can help me what is my mistake:
    The code below has been tested, no invalid field, all in place.
    Official code: https://github.com/organization/PmChair/blob/master/src/maru/PmChair.php#L45
    My code:
    PHP:
    $setEntityLinkPacket = new SetEntityLinkPacket ();
                    
    $setEntityLinkPacket->from $addEntityPacket->entityRuntimeId;
                    
    $setEntityLinkPacket->to $sender->getId(); // $sender instanceof Player
                    
    $setEntityLinkPacket->type 2// #questionmark

                    
    foreach ($this->getServer()->getOnlinePlayers() as $target) {
                        
    $target->dataPacket($addEntityPacket);
                        if (
    $sender !== $target) {
                            
    $target->dataPacket($setEntityLinkPacket);
                        }
                    }

                    
    $setEntityLinkPacket->to 0;
                    
    $sender->dataPacket($setEntityLinkPacket);
     
  6. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    Take a look at what I did here: https://github.com/BlockHorizons/Bl...BlockHorizons/BlockPets/pets/BasePet.php#L400
    It may help you.
     
  7. instantlyta

    instantlyta Slime

    Messages:
    96
    GitHub:
    intagaming
    PHP:
    $setEntityLinkPacket = new SetEntityLinkPacket ();
                    
    $setEntityLinkPacket->from $addEntityPacket->entityRuntimeId;
                    
    $setEntityLinkPacket->to $sender->getId();
                    
    $setEntityLinkPacket->type 2;

                    foreach (
    $this->getServer()->getOnlinePlayers() as $target) {
                        
    $target->dataPacket($addEntityPacket);
                        
    $target->dataPacket($setEntityLinkPacket);
                    }

                    
    $setEntityLinkPacket->to 0;
                    
    $sender->dataPacket($setEntityLinkPacket);
    This makes my screen shaking. Like when you are riding a boat, not a passenger and trying to rotate your screen, but have to sync to the server at the same time..
     
  8. instantlyta

    instantlyta Slime

    Messages:
    96
    GitHub:
    intagaming
  9. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    For some reason you have to send the data packet twice to the player that's riding/sitting on the entity, for it to show up to the player itself. The player is already linked to the entity because of the first packet broadcast, so there's no need to do it again.
     
  10. instantlyta

    instantlyta Slime

    Messages:
    96
    GitHub:
    intagaming
    Anyone please test PmChair with new code please?
     
  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.