From fdf5cf327a5a2df7ba87c40720a7a43f1371f47d Mon Sep 17 00:00:00 2001 From: NebulaCodesX Date: Sat, 21 Dec 2024 22:45:23 -0300 Subject: [PATCH] Create WeatherEffectPacket.php --- src/WeatherEffectPacket.php | 68 +++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/WeatherEffectPacket.php diff --git a/src/WeatherEffectPacket.php b/src/WeatherEffectPacket.php new file mode 100644 index 00000000..d8a820a2 --- /dev/null +++ b/src/WeatherEffectPacket.php @@ -0,0 +1,68 @@ +weatherType = $weatherType; + $result->duration = $duration; + $result->intensity = $intensity; + $result->isLocalEffect = $isLocalEffect; + $result->x = $x; + $result->y = $y; + $result->z = $z; + return $result; + } + + protected function decodePayload(PacketSerializer $in) : void { + $this->weatherType = $in->getByte(); + $this->duration = $in->getVarInt(); + $this->intensity = $in->getVarInt(); + $this->isLocalEffect = $in->getBool(); + $this->x = $in->getFloat(); + $this->y = $in->getFloat(); + $this->z = $in->getFloat(); + } + + protected function encodePayload(PacketSerializer $out) : void { + $out->putByte($this->weatherType); + $out->putVarInt($this->duration); + $out->putVarInt($this->intensity); + $out->putBool($this->isLocalEffect); + $out->putFloat($this->x); + $out->putFloat($this->y); + $out->putFloat($this->z); + } + + public function handle(PacketHandlerInterface $handler) : bool { + return $handler->handleWeatherEffect($this); + } +}