mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-28 13:45:37 -04:00
compressedNbt: clear OS field in gzip header to match MC
http://tools.ietf.org/html/rfc1952 defines the gzip header, which has an "OS (Operating System)" byte; node.js zlib https://nodejs.org/api/zlib.html sets OS to 0x03 (Unix) but Minecraft leaves it cleared to 0x00. To match Minecraft behavior byte-for-byte (important for examples/proxy/proxy.js), make sure this byte is cleared when writing compressedNbt.
This commit is contained in:
parent
d8b95d7755
commit
96c3ef3e34
@ -77,6 +77,7 @@ function writeCompressedNbt(value, buffer, offset) {
|
||||
nbt.proto.write(value,nbtBuffer,0,"nbt");
|
||||
|
||||
const compressedNbt = zlib.gzipSync(nbtBuffer); // TODO: async
|
||||
compressedNbt.writeUInt8(0, 9); // clear the OS field to match MC
|
||||
|
||||
buffer.writeInt16BE(compressedNbt.length,offset);
|
||||
compressedNbt.copy(buffer,offset+2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user