diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.World/AddPaintingPacket.cpp | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.World/AddPaintingPacket.cpp')
| -rw-r--r-- | Minecraft.World/AddPaintingPacket.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/Minecraft.World/AddPaintingPacket.cpp b/Minecraft.World/AddPaintingPacket.cpp new file mode 100644 index 00000000..f574cbf2 --- /dev/null +++ b/Minecraft.World/AddPaintingPacket.cpp @@ -0,0 +1,58 @@ +#include "stdafx.h" +#include <iostream> +#include "InputOutputStream.h" +#include "net.minecraft.world.entity.h" +#include "PacketListener.h" +#include "AddPaintingPacket.h" + + + +AddPaintingPacket::AddPaintingPacket() +{ + id = -1; + x = 0; + y = 0; + z = 0; + dir = 0; + motive = L""; +} + +AddPaintingPacket::AddPaintingPacket(shared_ptr<Painting> e) +{ + id = e->entityId; + x = e->xTile; + y = e->yTile; + z = e->zTile; + dir = e->dir; + motive = e->motive->name; +} + +void AddPaintingPacket::read(DataInputStream *dis) //throws IOException +{ + id = dis->readInt(); + motive = readUtf(dis, Painting::Motive::MAX_MOTIVE_NAME_LENGTH); + x = dis->readInt(); + y = dis->readInt(); + z = dis->readInt(); + dir = dis->readInt(); +} + +void AddPaintingPacket::write(DataOutputStream *dos) //throws IOException +{ + dos->writeInt(id); + writeUtf(motive, dos); + dos->writeInt(x); + dos->writeInt(y); + dos->writeInt(z); + dos->writeInt(dir); +} + +void AddPaintingPacket::handle(PacketListener *listener) +{ + listener->handleAddPainting(shared_from_this()); +} + +int AddPaintingPacket::getEstimatedSize() +{ + return 24; +} |
