76 $result->actorUniqueId = $actorUniqueId;
77 $result->actorRuntimeId = $actorRuntimeId;
78 $result->type = $type;
79 $result->position = $position;
80 $result->motion = $motion;
81 $result->pitch = $pitch;
83 $result->headYaw = $headYaw;
84 $result->bodyYaw = $bodyYaw;
85 $result->attributes = $attributes;
86 $result->metadata = $metadata;
87 $result->syncedProperties = $syncedProperties;
88 $result->links = $links;
93 $this->actorUniqueId =
CommonTypes::getActorUniqueId($in);
94 $this->actorRuntimeId = CommonTypes::getActorRuntimeId($in);
95 $this->type = CommonTypes::getString($in);
96 $this->position = CommonTypes::getVector3($in);
97 $this->motion = CommonTypes::getVector3($in);
98 $this->pitch = LE::readFloat($in);
99 $this->yaw = LE::readFloat($in);
100 $this->headYaw = LE::readFloat($in);
101 $this->bodyYaw = LE::readFloat($in);
103 $attrCount = VarInt::readUnsignedInt($in);
104 for($i = 0; $i < $attrCount; ++$i){
105 $id = CommonTypes::getString($in);
106 $min = LE::readFloat($in);
107 $current = LE::readFloat($in);
108 $max = LE::readFloat($in);
109 $this->attributes[] =
new Attribute($id, $min, $max, $current, $current, []);
112 $this->metadata = CommonTypes::getEntityMetadata($in);
113 $this->syncedProperties = PropertySyncData::read($in);
115 $linkCount = VarInt::readUnsignedInt($in);
116 for($i = 0; $i < $linkCount; ++$i){
117 $this->links[] = CommonTypes::getEntityLink($in);
122 CommonTypes::putActorUniqueId($out, $this->actorUniqueId);
123 CommonTypes::putActorRuntimeId($out, $this->actorRuntimeId);
124 CommonTypes::putString($out, $this->type);
125 CommonTypes::putVector3($out, $this->position);
126 CommonTypes::putVector3Nullable($out, $this->motion);
127 LE::writeFloat($out, $this->pitch);
128 LE::writeFloat($out, $this->yaw);
129 LE::writeFloat($out, $this->headYaw);
130 LE::writeFloat($out, $this->bodyYaw);
132 VarInt::writeUnsignedInt($out, count($this->attributes));
133 foreach($this->attributes as $attribute){
134 CommonTypes::putString($out, $attribute->getId());
135 LE::writeFloat($out, $attribute->getMin());
136 LE::writeFloat($out, $attribute->getCurrent());
137 LE::writeFloat($out, $attribute->getMax());
140 CommonTypes::putEntityMetadata($out, $this->metadata);
141 $this->syncedProperties->write($out);
143 VarInt::writeUnsignedInt($out, count($this->links));
144 foreach($this->links as $link){
145 CommonTypes::putEntityLink($out, $link);