mc-beta-server/server/packets/CloseWindow.ts
Holly 2e7535bf89
All checks were successful
Node.js Build / build (20.x) (push) Successful in 5m16s
working inventories
2024-12-02 00:25:03 +00:00

22 lines
No EOL
567 B
TypeScript

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();
}
}