mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-07-02 13:59:07 +02:00
world: fix deserialize of unpopulated 1.18+ sections
This commit is contained in:
parent
42a800e08c
commit
003b48951b
2 changed files with 51 additions and 28 deletions
|
@ -112,27 +112,36 @@ impl<'a> Chunk<'a> {
|
|||
let mut section_map = BTreeMap::new();
|
||||
|
||||
for section in sections {
|
||||
section_map.insert(
|
||||
SectionY(section.y),
|
||||
(
|
||||
SectionV1_13::new(
|
||||
data_version,
|
||||
section.block_states.data.as_deref(),
|
||||
§ion.block_states.palette,
|
||||
block_types,
|
||||
)
|
||||
.with_context(|| format!("Failed to load section at Y={}", section.y))?,
|
||||
BiomesV1_18::new(
|
||||
section.biomes.data.as_deref(),
|
||||
§ion.biomes.palette,
|
||||
biome_types,
|
||||
)
|
||||
.with_context(|| format!("Failed to load section biomes at Y={}", section.y))?,
|
||||
BlockLight::new(section.block_light.as_deref()).with_context(|| {
|
||||
format!("Failed to load section block light at Y={}", section.y)
|
||||
})?,
|
||||
),
|
||||
);
|
||||
match §ion.section {
|
||||
de::SectionV1_18Variants::V1_18 {
|
||||
block_states,
|
||||
biomes,
|
||||
block_light,
|
||||
} => {
|
||||
section_map.insert(
|
||||
SectionY(section.y),
|
||||
(
|
||||
SectionV1_13::new(
|
||||
data_version,
|
||||
block_states.data.as_deref(),
|
||||
&block_states.palette,
|
||||
block_types,
|
||||
)
|
||||
.with_context(|| {
|
||||
format!("Failed to load section at Y={}", section.y)
|
||||
})?,
|
||||
BiomesV1_18::new(biomes.data.as_deref(), &biomes.palette, biome_types)
|
||||
.with_context(|| {
|
||||
format!("Failed to load section biomes at Y={}", section.y)
|
||||
})?,
|
||||
BlockLight::new(block_light.as_deref()).with_context(|| {
|
||||
format!("Failed to load section block light at Y={}", section.y)
|
||||
})?,
|
||||
),
|
||||
);
|
||||
}
|
||||
de::SectionV1_18Variants::Empty {} => {}
|
||||
};
|
||||
}
|
||||
|
||||
Ok(Chunk::V1_18 { section_map })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue