add LevelEventPacket::standardParticle() sugar

This commit is contained in:
Dylan K. Taylor 2019-08-19 19:01:09 +01:00
parent 3274db3ddc
commit e52ba7201c
2 changed files with 5 additions and 1 deletions

View File

@ -129,6 +129,10 @@ class LevelEventPacket extends DataPacket implements ClientboundPacket{
return $pk;
}
public static function standardParticle(int $particleId, int $data, Vector3 $pos) : self{
return self::create(self::EVENT_ADD_PARTICLE_MASK | $particleId, $data, $pos);
}
protected function decodePayload() : void{
$this->evid = $this->getVarInt();
$this->position = $this->getVector3();

View File

@ -38,6 +38,6 @@ class GenericParticle implements Particle{
}
public function encode(Vector3 $pos){
return LevelEventPacket::create(LevelEventPacket::EVENT_ADD_PARTICLE_MASK | $this->id, $this->data, $pos);
return LevelEventPacket::standardParticle($this->id, $this->data, $pos);
}
}