Skip to content

Commit f39fe16

Browse files
committed
ServerboundDiagnosticsPacket: fix memoryCategoryValues size
1 parent de3ecf9 commit f39fe16

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/ServerboundDiagnosticsPacket.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use pmmp\encoding\ByteBufferReader;
1818
use pmmp\encoding\ByteBufferWriter;
1919
use pmmp\encoding\LE;
20+
use pmmp\encoding\VarInt;
2021
use pocketmine\network\mcpe\protocol\types\MemoryCategoryCounter;
2122
use function count;
2223

@@ -105,7 +106,7 @@ protected function decodePayload(ByteBufferReader $in) : void{
105106
$this->avgUnaccountedTimePercent = LE::readFloat($in);
106107

107108
$this->memoryCategoryValues = [];
108-
for($i = 0, $count = LE::readUnsignedInt($in); $i < $count; $i++){
109+
for($i = 0, $count = VarInt::readUnsignedInt($in); $i < $count; $i++){
109110
$this->memoryCategoryValues[] = MemoryCategoryCounter::read($in);
110111
}
111112
}
@@ -121,7 +122,7 @@ protected function encodePayload(ByteBufferWriter $out) : void{
121122
LE::writeFloat($out, $this->avgRemainderTimePercent);
122123
LE::writeFloat($out, $this->avgUnaccountedTimePercent);
123124

124-
LE::writeUnsignedInt($out, count($this->memoryCategoryValues));
125+
VarInt::writeUnsignedInt($out, count($this->memoryCategoryValues));
125126
foreach($this->memoryCategoryValues as $value){
126127
$value->write($out);
127128
}

0 commit comments

Comments
 (0)