13declare(strict_types=1);
15namespace pocketmine\network\mcpe\protocol;
26 public const NETWORK_ID = ProtocolInfo::ADD_ACTOR_PACKET;
28 public int $actorUniqueId;
29 public int $actorRuntimeId;
33 public float $pitch = 0.0;
34 public float $yaw = 0.0;
35 public float $headYaw = 0.0;
36 public float $bodyYaw = 0.0;
39 public array $attributes = [];
44 public array $metadata = [];
47 public array $links = [];
72 $result->actorUniqueId = $actorUniqueId;
73 $result->actorRuntimeId = $actorRuntimeId;
74 $result->type = $type;
75 $result->position = $position;
76 $result->motion = $motion;
77 $result->pitch = $pitch;
79 $result->headYaw = $headYaw;
80 $result->bodyYaw = $bodyYaw;
81 $result->attributes = $attributes;
82 $result->metadata = $metadata;
83 $result->syncedProperties = $syncedProperties;
84 $result->links = $links;
89 $this->actorUniqueId = $in->getActorUniqueId();
100 for($i = 0; $i < $attrCount; ++$i){
105 $this->attributes[] =
new Attribute($id, $min, $max, $current, $current, []);
109 $this->syncedProperties = PropertySyncData::read($in);
112 for($i = 0; $i < $linkCount; ++$i){
118 $out->putActorUniqueId($this->actorUniqueId);
119 $out->putActorRuntimeId($this->actorRuntimeId);
120 $out->putString($this->type);
123 $out->putLFloat($this->pitch);
124 $out->putLFloat($this->yaw);
125 $out->putLFloat($this->headYaw);
126 $out->putLFloat($this->bodyYaw);
129 foreach($this->attributes as $attribute){
130 $out->putString($attribute->getId());
131 $out->putLFloat($attribute->getMin());
132 $out->putLFloat($attribute->getCurrent());
133 $out->putLFloat($attribute->getMax());
137 $this->syncedProperties->write($out);
140 foreach($this->links as $link){
141 $out->putEntityLink($link);
146 return $handler->handleAddActor($this);
decodePayload(PacketSerializer $in)
static create(int $actorUniqueId, int $actorRuntimeId, string $type, Vector3 $position, ?Vector3 $motion, float $pitch, float $yaw, float $headYaw, float $bodyYaw, array $attributes, array $metadata, PropertySyncData $syncedProperties, array $links,)
encodePayload(PacketSerializer $out)
handle(PacketHandlerInterface $handler)
putVector3Nullable(?Vector3 $vector)
putEntityMetadata(array $metadata)
putVector3(Vector3 $vector)
putUnsignedVarInt(int $v)