mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-04 17:23:33 +01:00
world/chunk: add block light to section iterator items
This commit is contained in:
parent
482471492c
commit
51602d5fc1
2 changed files with 23 additions and 5 deletions
|
@ -203,6 +203,7 @@ impl<'a> Chunk<'a> {
|
|||
pub struct SectionIterItem<'a> {
|
||||
pub y: SectionY,
|
||||
pub section: &'a dyn Section,
|
||||
pub block_light: BlockLight<'a>,
|
||||
}
|
||||
|
||||
trait SectionIterTrait<'a>:
|
||||
|
@ -224,14 +225,30 @@ impl<'a> SectionIter<'a> {
|
|||
F: FnOnce(&mut dyn SectionIterTrait<'a>) -> T,
|
||||
{
|
||||
match &mut self.inner {
|
||||
SectionIterInner::V1_18 { iter } => {
|
||||
f(&mut iter.map(|(&y, (section, _, _))| SectionIterItem { y, section }))
|
||||
}
|
||||
SectionIterInner::V1_18 { iter } => f(&mut iter.map(
|
||||
|(&y, (section, _, block_light))| SectionIterItem {
|
||||
y,
|
||||
section,
|
||||
block_light: *block_light,
|
||||
},
|
||||
)),
|
||||
SectionIterInner::V1_13 { iter } => {
|
||||
f(&mut iter.map(|(&y, (section, _))| SectionIterItem { y, section }))
|
||||
f(
|
||||
&mut iter.map(|(&y, (section, block_light))| SectionIterItem {
|
||||
y,
|
||||
section,
|
||||
block_light: *block_light,
|
||||
}),
|
||||
)
|
||||
}
|
||||
SectionIterInner::V0 { iter } => {
|
||||
f(&mut iter.map(|(&y, (section, _))| SectionIterItem { y, section }))
|
||||
f(
|
||||
&mut iter.map(|(&y, (section, block_light))| SectionIterItem {
|
||||
y,
|
||||
section,
|
||||
block_light: *block_light,
|
||||
}),
|
||||
)
|
||||
}
|
||||
SectionIterInner::Empty => f(&mut iter::empty()),
|
||||
}
|
||||
|
|
|
@ -100,6 +100,7 @@ pub fn top_layer(chunk: &Chunk) -> Result<Box<BlockInfoArray>> {
|
|||
for SectionIterItem {
|
||||
y: section_y,
|
||||
section,
|
||||
block_light: _,
|
||||
} in chunk.sections().rev()
|
||||
{
|
||||
for y in BlockY::iter().rev() {
|
||||
|
|
Loading…
Add table
Reference in a new issue