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/SetEntityDataPacket.cpp | 64 +++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Minecraft.World/SetEntityDataPacket.cpp (limited to 'Minecraft.World/SetEntityDataPacket.cpp') diff --git a/Minecraft.World/SetEntityDataPacket.cpp b/Minecraft.World/SetEntityDataPacket.cpp new file mode 100644 index 00000000..1538c152 --- /dev/null +++ b/Minecraft.World/SetEntityDataPacket.cpp @@ -0,0 +1,64 @@ +#include "stdafx.h" +#include +#include "InputOutputStream.h" +#include "net.minecraft.world.entity.h" +#include "PacketListener.h" +#include "SetEntityDataPacket.h" + + + +SetEntityDataPacket::SetEntityDataPacket() +{ + id = -1; + packedItems = NULL; +} + +SetEntityDataPacket::~SetEntityDataPacket() +{ + delete packedItems; +} + +SetEntityDataPacket::SetEntityDataPacket(int id, shared_ptr entityData, bool notJustDirty) +{ + this->id = id; + if(notJustDirty) + { + this->packedItems = entityData->getAll(); + } + else + { + this->packedItems = entityData->packDirty(); + } +} + +void SetEntityDataPacket::read(DataInputStream *dis) //throws IOException +{ + id = dis->readInt(); + packedItems = SynchedEntityData::unpack(dis); +} + +void SetEntityDataPacket::write(DataOutputStream *dos) //throws IOException +{ + dos->writeInt(id); + SynchedEntityData::pack(packedItems, dos); +} + +void SetEntityDataPacket::handle(PacketListener *listener) +{ + listener->handleSetEntityData(shared_from_this()); +} + +int SetEntityDataPacket::getEstimatedSize() +{ + return 5; +} + +bool SetEntityDataPacket::isAync() +{ + return true; +} + +vector > *SetEntityDataPacket::getUnpackedData() +{ + return packedItems; +} -- cgit v1.2.3