Commit Diff


commit - d6138616a4e5ec2fef84f75e1322892c570881af
commit + 3151f0b6f261ceff3802a7b6da6b3b2d10c3a4fa
blob - d3f9bba7c4011521fbfc70eb86e46f9789e75421
blob + bc8c6598232abc9ab4e4a2d7c30b0713b9e7e684
--- src/main.c
+++ src/main.c
@@ -572,6 +572,24 @@ int main () {
       continue;
     }
 
+    // Received FEED packet, load world data from socket and disconnect
+    if (recv_buffer[0] == 0xFE && recv_buffer[1] == 0xED && getClientState(client_fd) == STATE_NONE) {
+      // Consume 0xFEED bytes (previous read was just a peek)
+      recv_all(client_fd, recv_buffer, 2, false);
+      // Write full buffers straight into memory
+      recv_all(client_fd, block_changes, sizeof(block_changes), false);
+      recv_all(client_fd, player_data, sizeof(player_data), false);
+      // Recover block_changes_count
+      for (int i = 0; i < MAX_BLOCK_CHANGES; i ++) {
+        if (block_changes[i].block == 0xFF) continue;
+        if (block_changes[i].block == B_chest) i += 14;
+        if (i >= block_changes_count) block_changes_count = i + 1;
+      }
+      // Kick the client
+      disconnectClient(&clients[client_index], 7);
+      continue;
+    }
+
     // Read packet length
     int length = readVarInt(client_fd);
     if (length == VARNUM_ERROR) {