mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-05 01:24:53 +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 struct SectionIterItem<'a> {
|
||||||
pub y: SectionY,
|
pub y: SectionY,
|
||||||
pub section: &'a dyn Section,
|
pub section: &'a dyn Section,
|
||||||
|
pub block_light: BlockLight<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
trait SectionIterTrait<'a>:
|
trait SectionIterTrait<'a>:
|
||||||
|
@ -224,14 +225,30 @@ impl<'a> SectionIter<'a> {
|
||||||
F: FnOnce(&mut dyn SectionIterTrait<'a>) -> T,
|
F: FnOnce(&mut dyn SectionIterTrait<'a>) -> T,
|
||||||
{
|
{
|
||||||
match &mut self.inner {
|
match &mut self.inner {
|
||||||
SectionIterInner::V1_18 { iter } => {
|
SectionIterInner::V1_18 { iter } => f(&mut iter.map(
|
||||||
f(&mut iter.map(|(&y, (section, _, _))| SectionIterItem { y, section }))
|
|(&y, (section, _, block_light))| SectionIterItem {
|
||||||
}
|
y,
|
||||||
|
section,
|
||||||
|
block_light: *block_light,
|
||||||
|
},
|
||||||
|
)),
|
||||||
SectionIterInner::V1_13 { iter } => {
|
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 } => {
|
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()),
|
SectionIterInner::Empty => f(&mut iter::empty()),
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,6 +100,7 @@ pub fn top_layer(chunk: &Chunk) -> Result<Box<BlockInfoArray>> {
|
||||||
for SectionIterItem {
|
for SectionIterItem {
|
||||||
y: section_y,
|
y: section_y,
|
||||||
section,
|
section,
|
||||||
|
block_light: _,
|
||||||
} in chunk.sections().rev()
|
} in chunk.sections().rev()
|
||||||
{
|
{
|
||||||
for y in BlockY::iter().rev() {
|
for y in BlockY::iter().rev() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue