aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/BlockRegionUpdatePacket.cpp
diff options
context:
space:
mode:
authordaoge <3523206925@qq.com>2026-03-03 03:04:10 +0800
committerGitHub <noreply@github.com>2026-03-03 03:04:10 +0800
commitb3feddfef372618c8a9d7a0abcaf18cfad866c18 (patch)
tree267761c3bb39241ba5c347bfbe2254d06686e287 /Minecraft.World/BlockRegionUpdatePacket.cpp
parent84c31a2331f7a0ec85b9d438992e244f60e5020f (diff)
feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict * feat: TU19 (Dec 2014) Features & Content (#32) * December 2014 files * Working release build * Fix compilation issues * Add sound to Windows64Media * Add DLC content and force Tutorial DLC * Revert "Add DLC content and force Tutorial DLC" This reverts commit 97a43994725008e35fceb984d5549df9c8cea470. * Disable broken light packing * Disable breakpoint during DLC texture map load Allows DLC loading but the DLC textures are still broken * Fix post build not working * ... * fix vs2022 build * fix cmake build --------- Co-authored-by: Loki <lokirautio@gmail.com>
Diffstat (limited to 'Minecraft.World/BlockRegionUpdatePacket.cpp')
-rw-r--r--Minecraft.World/BlockRegionUpdatePacket.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/Minecraft.World/BlockRegionUpdatePacket.cpp b/Minecraft.World/BlockRegionUpdatePacket.cpp
index d85321a5..bec943d8 100644
--- a/Minecraft.World/BlockRegionUpdatePacket.cpp
+++ b/Minecraft.World/BlockRegionUpdatePacket.cpp
@@ -11,6 +11,8 @@
#include "Dimension.h"
+#define BLOCK_REGION_UPDATE_FULLCHUNK 0x01
+#define BLOCK_REGION_UPDATE_ZEROHEIGHT 0x02 // added so we can still send a byte for ys, which really needs the range 0-256
BlockRegionUpdatePacket::~BlockRegionUpdatePacket()
{
@@ -82,10 +84,10 @@ BlockRegionUpdatePacket::BlockRegionUpdatePacket(int x, int y, int z, int xs, in
size = inputSize;
}
}
-
+
void BlockRegionUpdatePacket::read(DataInputStream *dis) //throws IOException
{
- bIsFullChunk = dis->readBoolean();
+ byte chunkFlags = dis->readByte();
x = dis->readInt();
y = dis->readShort();
z = dis->readInt();
@@ -93,6 +95,10 @@ void BlockRegionUpdatePacket::read(DataInputStream *dis) //throws IOException
ys = dis->read() + 1;
zs = dis->read() + 1;
+ bIsFullChunk = (chunkFlags & BLOCK_REGION_UPDATE_FULLCHUNK) ? true : false;
+ if(chunkFlags & BLOCK_REGION_UPDATE_ZEROHEIGHT)
+ ys = 0;
+
size = dis->readInt();
levelIdx = ( size >> 30 ) & 3;
size &= 0x3fffffff;
@@ -131,7 +137,11 @@ void BlockRegionUpdatePacket::read(DataInputStream *dis) //throws IOException
void BlockRegionUpdatePacket::write(DataOutputStream *dos) // throws IOException
{
- dos->writeBoolean(bIsFullChunk);
+ byte chunkFlags = 0;
+ if(bIsFullChunk) chunkFlags |= BLOCK_REGION_UPDATE_FULLCHUNK;
+ if(ys == 0) chunkFlags |= BLOCK_REGION_UPDATE_ZEROHEIGHT;
+
+ dos->writeByte(chunkFlags);
dos->writeInt(x);
dos->writeShort(y);
dos->writeInt(z);