Archived
0

fix: NetOutputStream.writeVarInt()

This commit is contained in:
2018-08-04 15:10:51 +03:00
parent 3750b1340d
commit 4206354760

View File

@@ -14,17 +14,16 @@ import java.util.UUID;
public abstract class NetOutputStream_p340 extends NetOutputStream {
@Override
public void writeVarInt(int value) {
do {
byte temp = (byte)(value & 0b01111111);
// Note: >>> means that the sign bit is shifted with the rest of the number rather than being left alone
while ((value & -128) != 0) {
writeByte(value & 127 | 128);
value >>>= 7;
if (value != 0) {
temp |= 0b10000000;
}
writeByte(temp);
} while (value != 0);
writeByte(value);
}
@Override
public void writeString(String value) {
if (value.length() > Short.MAX_VALUE) {