use pocketmine\network\mcpe\handler\PacketHandler; use pocketmine\network\mcpe\protocol\types\inventory\ItemStack; use pocketmine\network\mcpe\serializer\NetworkBinaryStream; class MobArmorEquipmentPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{ public const NETWORK_ID = ProtocolInfo::MOB_ARMOR_EQUIPMENT_PACKET; /** @var int */ public $entityRuntimeId; //this intentionally doesn't use an array because we don't want any implicit dependencies on internal order /** @var ItemStack */ public $head; /** @var ItemStack */ public $chest; /** @var ItemStack */ public $legs; /** @var ItemStack */ public $feet; public static function create(int $entityRuntimeId, ItemStack $head, ItemStack $chest, ItemStack $legs, ItemStack $feet) : self{ $result = new self; $result->entityRuntimeId = $entityRuntimeId; $result->head = $head; $result->chest = $chest; $result->legs = $legs; $result->feet = $feet; return $result; } protected function decodePayload(NetworkBinaryStream $in) : void{ $this->entityRuntimeId = $in->getEntityRuntimeId(); $this->head = $in->getSlot(); $this->chest = $in->getSlot(); $this->legs = $in->getSlot(); $this->feet = $in->getSlot(); } protected function encodePayload(NetworkBinaryStream $out) : void{ $out->putEntityRuntimeId($this->entityRuntimeId); $out->putSlot($this->head); $out->putSlot($this->chest); $out->putSlot($this->legs); $out->putSlot($this->feet); } public function handle(PacketHandler $handler) : bool{ return $handler->handleMobArmorEquipment($this); } }