13declare(strict_types=1);
 
   15namespace pocketmine\network\mcpe\protocol;
 
   17use pmmp\encoding\ByteBufferReader;
 
   18use pmmp\encoding\ByteBufferWriter;
 
   19use pmmp\encoding\VarInt;
 
   21use pocketmine\network\mcpe\protocol\types\MovementEffectType;
 
   24    public const NETWORK_ID = ProtocolInfo::MOVEMENT_EFFECT_PACKET;
 
   26    private int $actorRuntimeId;
 
   27    private MovementEffectType $effectType;
 
   28    private int $duration;
 
   34    public static function create(
int $actorRuntimeId, MovementEffectType $effectType, 
int $duration, 
int $tick) : self{
 
   36        $result->actorRuntimeId = $actorRuntimeId;
 
   37        $result->effectType = $effectType;
 
   38        $result->duration = $duration;
 
   39        $result->tick = $tick;
 
 
   43    public function getActorRuntimeId() : int{ return $this->actorRuntimeId; }
 
   45    public function getEffectType() : MovementEffectType{ return $this->effectType; }
 
   47    public function getDuration() : int{ return $this->duration; }
 
   49    public function getTick() : int{ return $this->tick; }
 
   52        $this->actorRuntimeId = 
CommonTypes::getActorRuntimeId($in);
 
   53        $this->effectType = MovementEffectType::fromPacket(VarInt::readUnsignedInt($in));
 
   54        $this->duration = VarInt::readUnsignedInt($in);
 
   55        $this->tick = VarInt::readUnsignedLong($in);
 
 
   59        CommonTypes::putActorRuntimeId($out, $this->actorRuntimeId);
 
   60        VarInt::writeUnsignedInt($out, $this->effectType->value);
 
   61        VarInt::writeUnsignedInt($out, $this->duration);
 
   62        VarInt::writeUnsignedLong($out, $this->tick);
 
 
   66        return $handler->handleMovementEffect($this);
 
 
 
encodePayload(ByteBufferWriter $out)
 
decodePayload(ByteBufferReader $in)
 
handle(PacketHandlerInterface $handler)
 
static create(int $actorRuntimeId, MovementEffectType $effectType, int $duration, int $tick)