fix: NetOutputStream.writeVarInt()
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user