mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Added missing attributes encoding to AddEntityPacket
This commit is contained in:
parent
6dc6e32656
commit
b89a17ffe2
@ -23,6 +23,8 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
#include <rules/DataPacket.h>
|
#include <rules/DataPacket.h>
|
||||||
|
|
||||||
|
use pocketmine\entity\Attribute;
|
||||||
|
|
||||||
#ifndef COMPILE
|
#ifndef COMPILE
|
||||||
use pocketmine\utils\Binary;
|
use pocketmine\utils\Binary;
|
||||||
|
|
||||||
@ -41,7 +43,8 @@ class AddEntityPacket extends DataPacket{
|
|||||||
public $speedZ;
|
public $speedZ;
|
||||||
public $yaw;
|
public $yaw;
|
||||||
public $pitch;
|
public $pitch;
|
||||||
public $modifiers;
|
/** @var Attribute[] */
|
||||||
|
public $attributes = [];
|
||||||
public $metadata = [];
|
public $metadata = [];
|
||||||
public $links = [];
|
public $links = [];
|
||||||
|
|
||||||
@ -58,7 +61,13 @@ class AddEntityPacket extends DataPacket{
|
|||||||
$this->putVector3f($this->speedX, $this->speedY, $this->speedZ);
|
$this->putVector3f($this->speedX, $this->speedY, $this->speedZ);
|
||||||
$this->putLFloat($this->pitch * (256 / 360));
|
$this->putLFloat($this->pitch * (256 / 360));
|
||||||
$this->putLFloat($this->yaw * (256 / 360));
|
$this->putLFloat($this->yaw * (256 / 360));
|
||||||
$this->putUnsignedVarInt($this->modifiers); //attributes?
|
$this->putUnsignedVarInt(count($this->attributes));
|
||||||
|
foreach($this->attributes as $entry){
|
||||||
|
$this->putString($entry->getName());
|
||||||
|
$this->putLFloat($entry->getMinValue());
|
||||||
|
$this->putLFloat($entry->getValue());
|
||||||
|
$this->putLFloat($entry->getMaxValue());
|
||||||
|
}
|
||||||
$meta = Binary::writeMetadata($this->metadata);
|
$meta = Binary::writeMetadata($this->metadata);
|
||||||
$this->put($meta);
|
$this->put($meta);
|
||||||
$this->putUnsignedVarInt(count($this->links));
|
$this->putUnsignedVarInt(count($this->links));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user