world/layer: return None from top_layer() for empty chunks

Allow ignoring these chunks for the light map as well.
This commit is contained in:
Matthias Schiffer 2023-03-04 20:33:10 +01:00
parent 202364bfca
commit 4fd316f3fc
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
3 changed files with 24 additions and 5 deletions

View file

@ -179,6 +179,15 @@ impl<'a> Chunk<'a> {
)
}
pub fn is_empty(&self) -> bool {
match self {
Chunk::V1_18 { section_map } => section_map.is_empty(),
Chunk::V1_13 { section_map, .. } => section_map.is_empty(),
Chunk::V0 { section_map, .. } => section_map.is_empty(),
Chunk::Empty => true,
}
}
/// Returns an interator over the chunk's sections and their Y coordinates
pub fn sections(&self) -> SectionIter {
use SectionIterInner::*;