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/ChunkVisibilityPacket.cpp | 47 +++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Minecraft.World/ChunkVisibilityPacket.cpp (limited to 'Minecraft.World/ChunkVisibilityPacket.cpp') 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 +#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; +} -- cgit v1.2.3