diff --git a/common/src/terrain/block.rs b/common/src/terrain/block.rs index e04c195396..1160c6877e 100644 --- a/common/src/terrain/block.rs +++ b/common/src/terrain/block.rs @@ -672,10 +672,12 @@ impl Block { #[must_use] pub fn from_u32(x: u32) -> Option { let [bk, r, g, b] = x.to_le_bytes(); - Some(Self { + let block = Self { kind: BlockKind::from_u8(bk)?, data: [r, g, b], - }) + }; + + (block.kind.is_filled() || SpriteKind::from_block(block).is_some()).then_some(block) } #[inline] diff --git a/server/src/terrain_persistence.rs b/server/src/terrain_persistence.rs index 9d3b1af9ee..25414ccf59 100644 --- a/server/src/terrain_persistence.rs +++ b/server/src/terrain_persistence.rs @@ -74,15 +74,11 @@ impl TerrainPersistence { } } - let removed = resets.len(); - // Reset any unchanged blocks (this is an optimisation only) for rpos in resets { loaded_chunk.chunk.reset_block(rpos); loaded_chunk.modified = true; } - - self.cached_chunks.limiter_mut().remove_blocks(removed); } /// Maintain terrain persistence (writing changes changes back to @@ -314,10 +310,6 @@ impl ByBlockLimiter { /// This function should only be used when it is guaranteed that a block has /// been added fn add_block(&mut self) { self.counted_blocks += 1; } - - /// This function should only be used when it is guaranteed that this number - /// of blocks has been removed - fn remove_blocks(&mut self, removed: usize) { self.counted_blocks -= removed; } } /// # Adding a new chunk format version