mc-beta-server/server/packets/CloseWindow.ts

22 lines
567 B
TypeScript
Raw Normal View History

2024-12-02 00:25:03 +00:00
import { createWriter, IReader, Endian } from "bufferstuff";
import IPacket from "./IPacket";
import Packet from "../enums/Packet";
export default class PacketCloseWindow implements IPacket {
public packetId = Packet.CloseWindow;
public windowId:number;
public constructor(windowId?:number) {
this.windowId = windowId ?? Number.MIN_VALUE;
}
public readData(reader:IReader) {
this.windowId = reader.readByte();
return this;
}
public writeData() {
return createWriter(Endian.BE, 2).writeUByte(this.packetId).writeByte(this.windowId).toBuffer();
}
}