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 PacketSpawnPosition implements IPacket {
|
2023-04-10 21:52:30 +01:00
|
|
|
public packetId = Packet.SpawnPosition;
|
2023-04-08 20:52:47 +01:00
|
|
|
public x:number;
|
|
|
|
public y:number;
|
|
|
|
public z:number;
|
|
|
|
|
|
|
|
public constructor(x:number, y:number, z:number) {
|
|
|
|
this.x = x;
|
|
|
|
this.y = y;
|
|
|
|
this.z = z;
|
|
|
|
}
|
|
|
|
|
|
|
|
public readData(reader:Reader) {
|
|
|
|
this.x = reader.readInt();
|
|
|
|
this.y = reader.readInt();
|
|
|
|
this.z = reader.readInt();
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public writeData() {
|
|
|
|
return new Writer(13).writeUByte(this.packetId).writeInt(this.x).writeInt(this.y).writeInt(this.z).toBuffer();
|
|
|
|
}
|
|
|
|
}
|