From 64a67d0ffe4a3fbd93f6a86e36b74a9ad08db7fe Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Mon, 2 Sep 2024 01:32:25 +0200 Subject: [PATCH] only save modified chunks --- kubi/src/world/loading.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/kubi/src/world/loading.rs b/kubi/src/world/loading.rs index 2ed2612..d1cbea4 100644 --- a/kubi/src/world/loading.rs +++ b/kubi/src/world/loading.rs @@ -287,11 +287,14 @@ fn process_state_changes( if let Some(io) = &io { if let Some(block_data) = &chunk.block_data { - // log::debug!("issue save command"); - io.send(IOCommand::SaveChunk { - position, - data: block_data.blocks.clone(), - }); + // Only save the chunk if it has been modified + if chunk.data_modified { + // log::debug!("issue save command"); + io.send(IOCommand::SaveChunk { + position, + data: block_data.blocks.clone(), + }); + } } }