-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Protocol changes for 1.21.50 #279
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look ok to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't there supposed to be new PlayerAuthInput
flags in this version? I thought that's why they added the bitset nastiness.
src/serializer/BitSet.php
Outdated
$last = $i + self::SHIFT >= $length; | ||
$bits |= $last ? 0 : 0x80; | ||
|
||
$buf .= chr($bits); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use putByte()
for this instead of using strings and ord
/chr
src/serializer/BitSet.php
Outdated
$currentShift = 0; | ||
|
||
for($i = 0; $i < $length; $i += self::SHIFT){ | ||
$b = ord($in->get(1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use getByte()
} | ||
self::assertTrue($test->get(64)); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a good idea to add a test for the constructor of this class too
hasFlag should probably be kept for compatibility |
It's a protocol update, we don't care about BC in the protocol. Every update requires breaking stuff anyway. |
@@ -118,20 +125,18 @@ public function write(PacketSerializer $out) : void{ | |||
$nextShift = $currentShift + self::SHIFT; | |||
if($nextShift >= self::INT_BITS){ | |||
$nextShift -= self::INT_BITS; | |||
$bits |= $parts[++$currentIndex] << (self::SHIFT - $nextShift); | |||
$bits |= ($parts[++$currentIndex] ?? 0) << (self::SHIFT - $nextShift); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be needed, the constructor already fills in the blanks
var_dump($i, $a->get($i), $b->get($i)); | ||
return false; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to clean up this debug code
No description provided.