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/ChunkVisibilityPacket.cpp | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.World/ChunkVisibilityPacket.cpp')
| -rw-r--r-- | Minecraft.World/ChunkVisibilityPacket.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Minecraft.World/ChunkVisibilityPacket.cpp b/Minecraft.World/ChunkVisibilityPacket.cpp new file mode 100644 index 00000000..75a1916c --- /dev/null +++ b/Minecraft.World/ChunkVisibilityPacket.cpp @@ -0,0 +1,47 @@ +#include "stdafx.h" +#include <iostream> +#include "InputOutputStream.h" +#include "PacketListener.h" +#include "ChunkVisibilityPacket.h" + + + +ChunkVisibilityPacket::ChunkVisibilityPacket() +{ + this->shouldDelay = false; + x = 0; + z = 0; + visible = false; +} + +ChunkVisibilityPacket::ChunkVisibilityPacket(int x, int z, bool visible) +{ + this->shouldDelay = false; + this->x = x; + this->z = z; + this->visible = visible; +} + +void ChunkVisibilityPacket::read(DataInputStream *dis) //throws IOException +{ + x = dis->readInt(); + z = dis->readInt(); + visible = dis->read() != 0; +} + +void ChunkVisibilityPacket::write(DataOutputStream *dos) //throws IOException +{ + dos->writeInt(x); + dos->writeInt(z); + dos->write(visible ? 1 : 0); +} + +void ChunkVisibilityPacket::handle(PacketListener *listener) +{ + listener->handleChunkVisibility(shared_from_this()); +} + +int ChunkVisibilityPacket::getEstimatedSize() +{ + return 9; +} |
