Clean up handling of armour sync

This commit is contained in:
Dylan K. Taylor
2019-05-19 16:56:10 +01:00
parent cd103cefcc
commit bca0833035
3 changed files with 17 additions and 51 deletions

View File

@ -48,6 +48,7 @@ use pocketmine\network\mcpe\protocol\ClientboundPacket;
use pocketmine\network\mcpe\protocol\DisconnectPacket;
use pocketmine\network\mcpe\protocol\InventoryContentPacket;
use pocketmine\network\mcpe\protocol\InventorySlotPacket;
use pocketmine\network\mcpe\protocol\MobArmorEquipmentPacket;
use pocketmine\network\mcpe\protocol\MobEffectPacket;
use pocketmine\network\mcpe\protocol\ModalFormRequestPacket;
use pocketmine\network\mcpe\protocol\MovePlayerPacket;
@ -817,6 +818,13 @@ class NetworkSession{
}
}
public function onMobArmorChange(Living $mob) : void{
$pk = new MobArmorEquipmentPacket();
$pk->entityRuntimeId = $mob->getId();
$pk->slots = $mob->getArmorInventory()->getContents(true); //beware this order might change in the future
$this->sendDataPacket($pk);
}
public function tick() : bool{
if($this->handler instanceof LoginSessionHandler){
if(time() >= $this->connectTime + 10){