mc-beta-server/server/Packets/Packet.js
2021-08-12 04:58:56 +01:00

21 lines
No EOL
365 B
JavaScript

const bufferStuff = require("../bufferStuff.js");
module.exports = class {
constructor(packetID = 0x00) {
this.id = packetID;
this.writer = null;
}
writePacket() {
this.writer = new bufferStuff.Writer();
this.writer.writeByte(this.id);
return this.writer;
}
toBuffer() {
return this.writer == null ? Buffer.alloc(0) : this.writer.buffer;
}
}