Fixed LegacyProtocolVersion returning wrong ids when protocols overlap

This commit is contained in:
RaphiMC 2023-08-26 01:11:10 +02:00
parent 46656e5f75
commit 122ceb8d1e
No known key found for this signature in database
GPG Key ID: 0F6BB0657A03AC94

View File

@ -75,10 +75,8 @@ public class LegacyProtocolVersion {
return a - b;
}
// Both are legacy
a = -a;
b = -b;
final int baseProtocolA = a >> 2;
final int baseProtocolB = b >> 2;
final int baseProtocolA = getRealProtocolVersion(a);
final int baseProtocolB = getRealProtocolVersion(b);
if (baseProtocolA != baseProtocolB) {
return baseProtocolA - baseProtocolB;
}
@ -93,7 +91,7 @@ public class LegacyProtocolVersion {
return protocolVersion;
}
return -protocolVersion >> 2;
return -(protocolVersion >> 2);
}