diff --git a/src/types/inventory/stackrequest/LoomStackRequestAction.php b/src/types/inventory/stackrequest/LoomStackRequestAction.php index dbf6f3f3..8436d2f8 100644 --- a/src/types/inventory/stackrequest/LoomStackRequestAction.php +++ b/src/types/inventory/stackrequest/LoomStackRequestAction.php @@ -14,6 +14,7 @@ namespace pocketmine\network\mcpe\protocol\types\inventory\stackrequest; +use pocketmine\network\mcpe\protocol\ProtocolInfo; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer; use pocketmine\network\mcpe\protocol\types\GetTypeIdFromConstTrait; @@ -36,12 +37,16 @@ public function getRepetitions() : int{ return $this->repetitions; } public static function read(PacketSerializer $in) : self{ $patternId = $in->getString(); - $repetitions = $in->getByte(); - return new self($patternId, $repetitions); + if($in->getProtocolId() >= ProtocolInfo::PROTOCOL_1_21_20){ + $repetitions = $in->getVarInt(); + } + return new self($patternId, $repetitions ?? 1); } public function write(PacketSerializer $out) : void{ $out->putString($this->patternId); - $out->putByte($this->repetitions); + if($out->getProtocolId() >= ProtocolInfo::PROTOCOL_1_21_20){ + $out->putByte($this->repetitions); + } } }