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.
The types are still exactly the same, they didn't change. If you fix up the other issues it should work just fine.
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
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.
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);
Take a look at what I did here: https://github.com/BlockHorizons/Bl...BlockHorizons/BlockPets/pets/BasePet.php#L400 It may help you.
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..
While your code also has this thing, what is the meaning of linking the pet/the fake chair to the entity 0?
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.