summaryrefslogtreecommitdiffstats
path: root/Tools/ProtoProxy/Connection.cpp
diff options
context:
space:
mode:
authorandrew <xdotftw@gmail.com>2014-01-21 19:40:41 +0100
committerandrew <xdotftw@gmail.com>2014-01-21 19:40:41 +0100
commit9bd8f74b598866539e3e5133188326bd7d14a827 (patch)
tree15f411bd03371e555250b898f3883c0fa20c2b8b /Tools/ProtoProxy/Connection.cpp
parentScoreboard SendTo() (diff)
parentFix a crash but somewhere... (diff)
downloadcuberite-9bd8f74b598866539e3e5133188326bd7d14a827.tar
cuberite-9bd8f74b598866539e3e5133188326bd7d14a827.tar.gz
cuberite-9bd8f74b598866539e3e5133188326bd7d14a827.tar.bz2
cuberite-9bd8f74b598866539e3e5133188326bd7d14a827.tar.lz
cuberite-9bd8f74b598866539e3e5133188326bd7d14a827.tar.xz
cuberite-9bd8f74b598866539e3e5133188326bd7d14a827.tar.zst
cuberite-9bd8f74b598866539e3e5133188326bd7d14a827.zip
Diffstat (limited to '')
-rw-r--r--Tools/ProtoProxy/Connection.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/Tools/ProtoProxy/Connection.cpp b/Tools/ProtoProxy/Connection.cpp
index 34da9b700..cd66e2dfd 100644
--- a/Tools/ProtoProxy/Connection.cpp
+++ b/Tools/ProtoProxy/Connection.cpp
@@ -2496,7 +2496,8 @@ bool cConnection::HandleServerUpdateTileEntity(void)
HANDLE_SERVER_PACKET_READ(ReadBEShort, short, BlockY);
HANDLE_SERVER_PACKET_READ(ReadBEInt, int, BlockZ);
HANDLE_SERVER_PACKET_READ(ReadByte, Byte, Action);
- HANDLE_SERVER_PACKET_READ(ReadBEShort, short, DataLength);
+ HANDLE_SERVER_PACKET_READ(ReadBEShort, short, DataLength);
+
AString Data;
if ((DataLength > 0) && !m_ServerBuffer.ReadString(Data, DataLength))
{
@@ -2506,6 +2507,18 @@ bool cConnection::HandleServerUpdateTileEntity(void)
Log(" Block = {%d, %d, %d}", BlockX, BlockY, BlockZ);
Log(" Action = %d", Action);
DataLog(Data.data(), Data.size(), " Data (%u bytes)", Data.size());
+
+ // Save metadata to a file:
+ AString fnam;
+ Printf(fnam, "%s_item_%08x.nbt", m_LogNameBase.c_str(), m_ItemIdx++);
+ FILE * f = fopen(fnam.c_str(), "wb");
+ if (f != NULL)
+ {
+ fwrite(Data.data(), 1, Data.size(), f);
+ fclose(f);
+ Log("(saved to file \"%s\")", fnam.c_str());
+ }
+
COPY_TO_CLIENT();
return true;
}