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

22 lines
505 B
TypeScript
Raw Normal View History

2023-04-08 20:52:47 +01:00
import { Reader, Writer } from "../../bufferStuff";
2023-04-10 21:52:30 +01:00
import { Packet } from "../enums/Packet";
2023-04-08 20:52:47 +01:00
import { IPacket } from "./IPacket";
export class PacketRespawn implements IPacket {
2023-04-10 21:52:30 +01:00
public packetId = Packet.Respawn;
2023-04-08 20:52:47 +01:00
public health:number;
public constructor(health:number) {
this.health = health;
}
public readData(reader:Reader) {
this.health = reader.readShort();
return this;
}
public writeData() {
return new Writer(3).writeUByte(this.packetId).writeShort(this.health).toBuffer();
}
}