From b691c43c44ff180d10e7d4a9afc83b98551ff586 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Sun, 1 Mar 2026 12:16:08 +0800 Subject: Initial commit --- Minecraft.World/MovePlayerPacket.h | 78 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Minecraft.World/MovePlayerPacket.h (limited to 'Minecraft.World/MovePlayerPacket.h') diff --git a/Minecraft.World/MovePlayerPacket.h b/Minecraft.World/MovePlayerPacket.h new file mode 100644 index 00000000..26ae8392 --- /dev/null +++ b/Minecraft.World/MovePlayerPacket.h @@ -0,0 +1,78 @@ +#pragma once +using namespace std; + +#include "Packet.h" + +class MovePlayerPacket : public Packet, public enable_shared_from_this +{ +public: + class PosRot; + class Pos; + class Rot; + + double x, y, z, yView; + float yRot, xRot; + bool onGround; + bool hasPos, hasRot; + bool isFlying; // 4J Added + + MovePlayerPacket(); + MovePlayerPacket(bool onGround, bool isFlying); + + virtual void handle(PacketListener *listener); + virtual void read(DataInputStream *dis); + virtual void write(DataOutputStream *dos); + virtual int getEstimatedSize(); + virtual bool canBeInvalidated(); + virtual bool isInvalidatedBy(shared_ptr packet); + +public: + static shared_ptr create() { return shared_ptr(new MovePlayerPacket()); } + virtual int getId() { return 10; } +}; + +class MovePlayerPacket::PosRot : public MovePlayerPacket +{ +public: + PosRot(); + PosRot(double x, double y, double yView, double z, float yRot, float xRot, bool onGround, bool isFlying); + + virtual void read(DataInputStream *dis); + virtual void write(DataOutputStream *dos); + virtual int getEstimatedSize(); + +public: + static shared_ptr create() { return shared_ptr(new MovePlayerPacket::PosRot()); } + virtual int getId() { return 13; } +}; + +class MovePlayerPacket::Pos : public MovePlayerPacket +{ +public: + Pos(); + Pos(double x, double y, double yView, double z, bool onGround, bool isFlying); + + virtual void read(DataInputStream *dis); + virtual void write(DataOutputStream *dos); + virtual int getEstimatedSize(); + +public: + static shared_ptr create() { return shared_ptr(new MovePlayerPacket::Pos()); } + virtual int getId() { return 11; } + +}; + +class MovePlayerPacket::Rot : public MovePlayerPacket +{ +public: + Rot(); + Rot(float yRot, float xRot, bool onGround, bool isFlying); + + virtual void read(DataInputStream *dis); + virtual void write(DataOutputStream *dos); + virtual int getEstimatedSize(); +public: + static shared_ptr create() { return shared_ptr(new MovePlayerPacket::Rot()); } + virtual int getId() { return 12; } + +}; \ No newline at end of file -- cgit v1.2.3