From fa6bfc154b4eb86959522d34985fa453e26dd51b Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Wed, 26 Dec 2012 09:08:44 +0000 Subject: [PATCH] ProtoProxy: more 1.4.6 stuff, now the connection holds stable with the 1.4.6 client. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1103 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- ProtoProxy/Connection.cpp | 37 +++++++++++++++++++++++++++++++++++++ ProtoProxy/Connection.h | 2 ++ 2 files changed, 39 insertions(+) diff --git a/ProtoProxy/Connection.cpp b/ProtoProxy/Connection.cpp index aba0c8255..fabdebfe2 100644 --- a/ProtoProxy/Connection.cpp +++ b/ProtoProxy/Connection.cpp @@ -111,6 +111,7 @@ enum PACKET_PLAYER_POSITION = 0x0b, PACKET_PLAYER_LOOK = 0x0c, PACKET_PLAYER_POSITION_LOOK = 0x0d, + PACKET_BLOCK_DIG = 0x0e, PACKET_BLOCK_PLACE = 0x0f, PACKET_SLOT_SELECT = 0x10, PACKET_ANIMATION = 0x12, @@ -504,6 +505,7 @@ bool cConnection::DecodeClientsPackets(const char * a_Data, int a_Size) switch (PacketType) { case PACKET_ANIMATION: HANDLE_CLIENT_READ(HandleClientAnimation); break; + case PACKET_BLOCK_DIG: HANDLE_CLIENT_READ(HandleClientBlockDig); break; case PACKET_BLOCK_PLACE: HANDLE_CLIENT_READ(HandleClientBlockPlace); break; case PACKET_CHAT_MESSAGE: HANDLE_CLIENT_READ(HandleClientChatMessage); break; case PACKET_CLIENT_STATUSES: HANDLE_CLIENT_READ(HandleClientClientStatuses); break; @@ -615,6 +617,7 @@ bool cConnection::DecodeServersPackets(const char * a_Data, int a_Size) case PACKET_PLAYER_POSITION_LOOK: HANDLE_SERVER_READ(HandleServerPlayerPositionLook); break; case PACKET_SET_EXPERIENCE: HANDLE_SERVER_READ(HandleServerSetExperience); break; case PACKET_SET_SLOT: HANDLE_SERVER_READ(HandleServerSetSlot); break; + case PACKET_SLOT_SELECT: HANDLE_SERVER_READ(HandleServerSlotSelect); break; case PACKET_SOUND_EFFECT: HANDLE_SERVER_READ(HandleServerSoundEffect); break; case PACKET_SPAWN_MOB: HANDLE_SERVER_READ(HandleServerSpawnMob); break; case PACKET_SPAWN_OBJECT_VEHICLE: HANDLE_SERVER_READ(HandleServerSpawnObjectVehicle); break; @@ -679,6 +682,25 @@ bool cConnection::HandleClientAnimation(void) +bool cConnection::HandleClientBlockDig(void) +{ + HANDLE_CLIENT_PACKET_READ(ReadByte, Byte, Status); + HANDLE_CLIENT_PACKET_READ(ReadBEInt, int, BlockX); + HANDLE_CLIENT_PACKET_READ(ReadByte, Byte, BlockY); + HANDLE_CLIENT_PACKET_READ(ReadBEInt, int, BlockZ); + HANDLE_CLIENT_PACKET_READ(ReadByte, Byte, BlockFace); + Log("Received a PACKET_BLOCK_DIG from the client:"); + Log(" Status = %d", Status); + Log(" Pos = <%d, %d, %d>", BlockX, BlockY, BlockZ); + Log(" BlockFace = %d", BlockFace); + COPY_TO_SERVER(); + return true; +} + + + + + bool cConnection::HandleClientBlockPlace(void) { HANDLE_CLIENT_PACKET_READ(ReadBEInt, int, BlockX); @@ -1458,6 +1480,7 @@ bool cConnection::HandleServerMapChunkBulk(void) { HANDLE_SERVER_PACKET_READ(ReadBEShort, short, ChunkCount); HANDLE_SERVER_PACKET_READ(ReadBEInt, int, CompressedSize); + HANDLE_SERVER_PACKET_READ(ReadBool, bool, IsSkyLightSent); AString CompressedData; if (!m_ServerBuffer.ReadString(CompressedData, CompressedSize)) { @@ -1471,6 +1494,7 @@ bool cConnection::HandleServerMapChunkBulk(void) Log("Received a PACKET_MAP_CHUNK_BULK from the server:"); Log(" ChunkCount = %d", ChunkCount); Log(" Compressed size = %d (0x%x)", CompressedSize, CompressedSize); + Log(" IsSkyLightSent = %s", IsSkyLightSent ? "true" : "false"); // TODO: Save the compressed data into a file for later analysis @@ -1617,6 +1641,19 @@ bool cConnection::HandleServerSetSlot(void) +bool cConnection::HandleServerSlotSelect(void) +{ + HANDLE_SERVER_PACKET_READ(ReadBEShort, short, SlotNum); + Log("Received a PACKET_SLOT_SELECT from the server:"); + Log(" SlotNum = %d", SlotNum); + COPY_TO_CLIENT(); + return true; +} + + + + + bool cConnection::HandleServerSoundEffect(void) { HANDLE_SERVER_PACKET_READ(ReadBEInt, int, EffectID); diff --git a/ProtoProxy/Connection.h b/ProtoProxy/Connection.h index 307076ed8..7dc642042 100644 --- a/ProtoProxy/Connection.h +++ b/ProtoProxy/Connection.h @@ -98,6 +98,7 @@ protected: // Packet handling, client-side: bool HandleClientAnimation(void); + bool HandleClientBlockDig(void); bool HandleClientBlockPlace(void); bool HandleClientChatMessage(void); bool HandleClientClientStatuses(void); @@ -151,6 +152,7 @@ protected: bool HandleServerPlayerPositionLook(void); bool HandleServerSetExperience(void); bool HandleServerSetSlot(void); + bool HandleServerSlotSelect(void); bool HandleServerSoundEffect(void); bool HandleServerSpawnMob(void); bool HandleServerSpawnObjectVehicle(void);