mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-09 07:19:12 +00:00
Merge pull request #144 from MathiewMay/dev
Fixed packet desync caused by entity ID overflowing
This commit is contained in:
commit
17e113f292
|
|
@ -73,18 +73,20 @@ void SetEntityMotionPacket::read(DataInputStream *dis) //throws IOException
|
|||
}
|
||||
}
|
||||
|
||||
void SetEntityMotionPacket::write(DataOutputStream *dos) //throws IOException
|
||||
void SetEntityMotionPacket::write(DataOutputStream *dos) //throws IOException
|
||||
{
|
||||
if( useBytes )
|
||||
{
|
||||
dos->writeShort(id | 0x800);
|
||||
// Masking the id to 11 bits before writing to account for large entitty ids.
|
||||
dos->writeShort((id & 0x07FF) | 0x800);
|
||||
dos->writeByte(xa/16);
|
||||
dos->writeByte(ya/16);
|
||||
dos->writeByte(za/16);
|
||||
}
|
||||
else
|
||||
{
|
||||
dos->writeShort(id);
|
||||
// same thing as line 80 here
|
||||
dos->writeShort((id & 0x07FF));
|
||||
dos->writeShort(xa);
|
||||
dos->writeShort(ya);
|
||||
dos->writeShort(za);
|
||||
|
|
|
|||
Loading…
Reference in a new issue