Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Protocol changes for 1.21.50 #279

wants to merge 5 commits into from

Conversation

dries-c
Copy link
Member

@dries-c dries-c commented Nov 25, 2024

No description provided.

Copy link
Member

@ShockedPlot7560 ShockedPlot7560 left a 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

Copy link
Member

@dktapps dktapps left a 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.

$last = $i + self::SHIFT >= $length;
$bits |= $last ? 0 : 0x80;

$buf .= chr($bits);
Copy link
Member

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

$currentShift = 0;

for($i = 0; $i < $length; $i += self::SHIFT){
$b = ord($in->get(1));
Copy link
Member

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));
}
}
Copy link
Member

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

@dktapps dktapps requested a review from a team December 3, 2024 14:14
@GameParrot
Copy link

hasFlag should probably be kept for compatibility

@dktapps
Copy link
Member

dktapps commented Dec 3, 2024

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);
Copy link
Member

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;
}
}
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants