mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
LevelEventPacket: added create() to reduce boilerplate code
This commit is contained in:
@ -119,6 +119,14 @@ class LevelEventPacket extends DataPacket implements ClientboundPacket{
|
||||
/** @var int */
|
||||
public $data;
|
||||
|
||||
public static function create(int $evid, int $data, ?Vector3 $pos) : self{
|
||||
$pk = new self;
|
||||
$pk->evid = $evid;
|
||||
$pk->data = $data;
|
||||
$pk->position = $pos !== null ? $pos->asVector3() : null;
|
||||
return $pk;
|
||||
}
|
||||
|
||||
protected function decodePayload() : void{
|
||||
$this->evid = $this->getVarInt();
|
||||
$this->position = $this->getVector3();
|
||||
|
Reference in New Issue
Block a user