22 lines
No EOL
515 B
TypeScript
22 lines
No EOL
515 B
TypeScript
import { Reader, Writer } from "../../bufferStuff";
|
|
import { Packet } from "../enums/Packet";
|
|
import { IPacket } from "./IPacket";
|
|
|
|
export class PacketUpdateHealth implements IPacket {
|
|
public packetId = Packet.UpdateHealth;
|
|
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();
|
|
}
|
|
} |