diff options
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/client.cpp b/src/client.cpp index 7093a5190..4d9233d66 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1507,7 +1507,8 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id) } else if(command == TOCLIENT_TOOLDEF) { - infostream<<"Client: Received tool definitions"<<std::endl; + infostream<<"Client: Received tool definitions: packet size: " + <<datasize<<std::endl; std::string datastring((char*)&data[2], datasize-2); std::istringstream is(datastring, std::ios_base::binary); @@ -1589,6 +1590,31 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id) event.type = CE_TEXTURES_UPDATED; m_client_event_queue.push_back(event); } + else if(command == TOCLIENT_NODEDEF) + { + infostream<<"Client: Received node definitions: packet size: " + <<datasize<<std::endl; + + std::string datastring((char*)&data[2], datasize-2); + std::istringstream is(datastring, std::ios_base::binary); + + // Stop threads while updating content definitions + m_mesh_update_thread.stop(); + + std::istringstream tmp_is(deSerializeLongString(is), std::ios::binary); + m_nodedef->deSerialize(tmp_is, this); + + // Update texture atlas + if(g_settings->getBool("enable_texture_atlas")) + m_tsrc->buildMainAtlas(this); + + // Update node textures + m_nodedef->updateTextures(m_tsrc); + + // Resume threads + m_mesh_update_thread.setRun(true); + m_mesh_update_thread.Start(); + } else { infostream<<"Client: Ignoring unknown command " |