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 freezesIf 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);
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'.
@Muqsit I doubt it has to do with the packet. It works fine for the other entities, just not animals that should be ridden.
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.
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.