1
0
Fork 0
mirror of https://github.com/demostf/demo.js synced 2026-06-04 09:04:13 +02:00

add encoder for packet message

This commit is contained in:
Robin Appelman 2017-09-24 17:16:57 +02:00
commit 5241059fd2
8 changed files with 180 additions and 22 deletions

View file

@ -192,7 +192,7 @@ export function ParsePacketEntities(stream: BitStream, state: ParserState, skip:
export function EncodePacketEntities(packet: PacketEntitiesPacket, stream: BitStream, state: ParserState) {
stream.writeBits(packet.maxEntries, 11);
const isDelta = packet.removedEntities.length > 0;
const isDelta = packet.delta > 0;
stream.writeBoolean(isDelta);
if (isDelta) {
stream.writeInt32(packet.delta);

View file

@ -76,5 +76,7 @@ export function EncodeTempEntities(packet: TempEntitiesPacket, stream: BitStream
writeVarInt(entityDataLength, stream);
stream.writeBitStream(entityStream, entityDataLength);
if (entityDataLength > 0) {
stream.writeBitStream(entityStream, entityDataLength);
}
}