mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 02:42:58 +00:00
Standardised attributes encoding
This commit is contained in:
@ -30,7 +30,6 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class UpdateAttributesPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::UPDATE_ATTRIBUTES_PACKET;
|
||||
|
||||
|
||||
public $entityId;
|
||||
/** @var Attribute[] */
|
||||
public $entries = [];
|
||||
@ -42,14 +41,7 @@ class UpdateAttributesPacket extends DataPacket{
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putEntityRuntimeId($this->entityId);
|
||||
$this->putUnsignedVarInt(count($this->entries));
|
||||
foreach($this->entries as $entry){
|
||||
$this->putLFloat($entry->getMinValue());
|
||||
$this->putLFloat($entry->getMaxValue());
|
||||
$this->putLFloat($entry->getValue());
|
||||
$this->putLFloat($entry->getDefaultValue());
|
||||
$this->putString($entry->getName());
|
||||
}
|
||||
$this->putAttributeList(...$this->entries);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
Reference in New Issue
Block a user