From 18a699521fbe75ae591d98366ef0e3c734a9d83e Mon Sep 17 00:00:00 2001 From: zani Date: Mon, 13 Jan 2025 15:12:20 -0700 Subject: [PATCH] fix: replace invalid block states with air --- src/protocol/packets/play/world.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/protocol/packets/play/world.rs b/src/protocol/packets/play/world.rs index b7dcaac..2b93b08 100644 --- a/src/protocol/packets/play/world.rs +++ b/src/protocol/packets/play/world.rs @@ -311,7 +311,8 @@ impl ChunkSection { let blocks: Vec = blocks .iter() - .map(|b| palette.get(*b as usize).unwrap().0) + // todo: come up with a better way to do this(?) + .map(|b| palette.get(*b as usize).unwrap_or(&BlockState::AIR).0) .collect(); let block_count = blocks.iter().filter(|b| **b != 0).collect::>().len(); -- 2.51.2