From f8c8dcc7f36366dc6b59e6741d466e739322d5d1 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 19 Jan 2014 00:54:38 +0000 Subject: Improved command blocks * Their command and previous output are displayed on the client * They have a BlockHandler implementation, so you can't place blocks on them anymore + As a side effect, implemented UpdateBlockEntity --- src/Protocol/Protocol17x.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/Protocol/Protocol17x.cpp') diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 5b3a79555..01a6b0bde 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -892,6 +892,20 @@ void cProtocol172::SendUnloadChunk(int a_ChunkX, int a_ChunkZ) +void cProtocol172::SendUpdateBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, Byte a_Action, cFastNBTWriter & a_NBT) +{ + cPacketizer Pkt(*this, 0x35); // Update tile entity packet + Pkt.WriteInt(a_BlockX); + Pkt.WriteShort(a_BlockY); + Pkt.WriteInt(a_BlockZ); + Pkt.WriteByte(a_Action); + + Pkt.WriteBlockEntity(a_NBT); +} + + + + void cProtocol172::SendUpdateSign(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) { @@ -1819,6 +1833,17 @@ void cProtocol172::cPacketizer::WriteItem(const cItem & a_Item) +void cProtocol172::cPacketizer::WriteBlockEntity(const cFastNBTWriter & a_NBT) +{ + AString Compressed; + CompressStringGZIP(a_NBT.GetResult().data(), a_NBT.GetResult().size(), Compressed); + WriteShort(Compressed.size()); + WriteBuf(Compressed.data(), Compressed.size()); +} + + + + void cProtocol172::cPacketizer::WriteByteAngle(double a_Angle) { -- cgit v1.2.3