world: introduce SectionIterItem struct

This commit is contained in:
Matthias Schiffer 2023-03-04 16:53:53 +01:00
parent ed422be451
commit 47dc3795a3
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
3 changed files with 24 additions and 14 deletions

View file

@ -1,7 +1,7 @@
use anyhow::{Context, Result};
use serde::{Deserialize, Serialize};
use super::chunk::Chunk;
use super::chunk::{Chunk, SectionIterItem};
use crate::{
resource::{BlockFlag, BlockType},
types::*,
@ -97,7 +97,11 @@ pub fn top_layer(chunk: &Chunk) -> Result<Box<BlockInfoArray>> {
let mut done = 0;
let mut ret = Box::<BlockInfoArray>::default();
for (section_y, section) in chunk.sections().rev() {
for SectionIterItem {
y: section_y,
section,
} in chunk.sections().rev()
{
for y in BlockY::iter().rev() {
for xz in BlockInfoArray::keys() {
let entry = &mut ret[xz];