13declare(strict_types=1);
15namespace pocketmine\network\mcpe\protocol;
20 public const NETWORK_ID = ProtocolInfo::MOB_EFFECT_PACKET;
22 public const EVENT_ADD = 1;
23 public const EVENT_MODIFY = 2;
24 public const EVENT_REMOVE = 3;
26 public int $actorRuntimeId;
29 public int $amplifier = 0;
30 public bool $particles =
true;
31 public int $duration = 0;
47 $result->actorRuntimeId = $actorRuntimeId;
48 $result->eventId = $eventId;
49 $result->effectId = $effectId;
50 $result->amplifier = $amplifier;
51 $result->particles = $particles;
52 $result->duration = $duration;
53 $result->tick = $tick;
57 public static function add(
int $actorRuntimeId,
bool $replace,
int $effectId,
int $amplifier,
bool $particles,
int $duration,
int $tick) : self{
58 return self::create($actorRuntimeId, $replace ? self::EVENT_MODIFY : self::EVENT_ADD, $effectId, $amplifier, $particles, $duration, $tick);
61 public static function remove(
int $actorRuntimeId,
int $effectId,
int $tick) :
self{
62 return self::create($actorRuntimeId, self::EVENT_REMOVE, $effectId, 0,
false, 0, $tick);
66 $this->actorRuntimeId = $in->getActorRuntimeId();
67 $this->eventId = $in->
getByte();
70 $this->particles = $in->
getBool();
76 $out->putActorRuntimeId($this->actorRuntimeId);
77 $out->putByte($this->eventId);
80 $out->putBool($this->particles);
82 $out->putLLong($this->tick);
86 return $handler->handleMobEffect($this);
encodePayload(PacketSerializer $out)
handle(PacketHandlerInterface $handler)
static create(int $actorRuntimeId, int $eventId, int $effectId, int $amplifier, bool $particles, int $duration, int $tick,)
decodePayload(PacketSerializer $in)