Read multiple packets per chunk

This commit is contained in:
Holly Stubbs 2023-11-07 01:50:35 +00:00
parent 0403ace046
commit 61b667ac49
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E
3 changed files with 10 additions and 6 deletions

8
package-lock.json generated
View file

@ -9,7 +9,7 @@
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"bufferstuff": "^1.3.4",
"bufferstuff": "^1.4.2",
"hsconsole": "^1.0.2"
},
"devDependencies": {
@ -563,9 +563,9 @@
"dev": true
},
"node_modules/bufferstuff": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/bufferstuff/-/bufferstuff-1.3.4.tgz",
"integrity": "sha512-oBaMs5roIpkG242dWSoS38BWeVxlpTKVhRTRnGmZy5/6H+XU6YJMGa6jmPl7ychEnOqpuSA8wiq2k12zPt4BDA=="
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/bufferstuff/-/bufferstuff-1.4.2.tgz",
"integrity": "sha512-iCULTXTrD9O4C06u+gjgQ3RtVNXAfxoBmQbAh1nMRO7QENVNuC/UvbFk25x/PDMA9yhdkJtfLo2dwxSJvEjlSg=="
},
"node_modules/call-bind": {
"version": "1.0.2",

View file

@ -24,7 +24,7 @@
},
"homepage": "https://github.com/tgpholly/mc-beta-server#readme",
"dependencies": {
"bufferstuff": "^1.3.4",
"bufferstuff": "^1.4.2",
"hsconsole": "^1.0.2"
},
"devDependencies": {

View file

@ -83,7 +83,11 @@ export class MPClient {
case Packet.Animation: this.handlePacketAnimation(new PacketAnimation().readData(reader)); break;
case Packet.EntityAction: this.handlePacketEntityAction(new PacketEntityAction().readData(reader)); break;
case Packet.DisconnectKick: this.handleDisconnectKick(); break;
default: Console.printWarn(`UNIMPLEMENTED PACKET: ${Packet[packetId]}`); break;
default: return Console.printWarn(`UNIMPLEMENTED PACKET: ${Packet[packetId]}`);
}
if (reader.readOffset < reader.length - 1) {
this.handlePacket(reader);
}
}