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

Link entities

Discussion in 'Development' started by #A6543, Jun 18, 2017.

  1. #A6543

    #A6543 Zombie

    Messages:
    267
    Please don't move this to facepalm... I have a problem with the SetEntityLinkPacket. If I link two entities it works fine. But if I can ride this entity in singleplayer, the client crashes if he closes the chat. My code:
    PHP:

    /*
    This code is executed after running a command. If I use a pig the player moves to the pig and it looks like he is sitting on it. But if he closes the chat window the screen freezes

    If u need more information or something please ask me and don't move this to facepalm :/
    */

    $pk = new SetEntityLinkPacket();
            
    $pk->to $player->getId();
            
    $pk->from $this->getId();
            
    $pk->type self::STATE_SITTING;
            
    $this->server->broadcastPacket($this->level->getPlayers(), $pk);
            
    $pk = new SetEntityLinkPacket();
            
    $pk->to 0;
            
    $pk->from $this->getId();
            
    $pk->type self::STATE_SITTING;
            
    $player->dataPacket($pk);
     
  2. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    This is in fact an issue I have still to investigate myself. Riding entities that are supposed to be ridden freezes/crashes the client without 'doing what should be done'.
     
  3. #A6543

    #A6543 Zombie

    Messages:
    267
    Is it client side or can we do something?
     
  4. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    If it doesn't crash in single player, then you can try debugging (messing) with the packet.
     
  5. #A6543

    #A6543 Zombie

    Messages:
    267
    It crashes on my server if I link the entity
     
  6. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    @Muqsit I doubt it has to do with the packet. It works fine for the other entities, just not animals that should be ridden.
     
  7. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Okay, there's a data flag for riding, I believe it has a role to play too?
     
    Last edited: Jun 19, 2017
  8. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    I tried setting the saddled dataflag to the ridden entity, didn't work. I tried setting the rider with the dataflag riding, but MCPE already does that by default when linking an entity.
     
  9. #A6543

    #A6543 Zombie

    Messages:
    267
    I also tried this with the saddle
     
  10. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    You might want to try setting the tamed dataflag to true. According to the wiki horses, pigs and llamas can't be ridden if they aren't tamed, which would explain the sudden game freeze.
     
  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.