world/de: rename Variants enums to Variant

This commit is contained in:
Matthias Schiffer 2023-11-25 19:01:36 +01:00
parent b32bdb4d8e
commit 74a4fc93d0
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
2 changed files with 13 additions and 13 deletions

View file

@ -93,10 +93,10 @@ impl<'a> Chunk<'a> {
let data_version = data.data_version.unwrap_or_default(); let data_version = data.data_version.unwrap_or_default();
match &data.chunk { match &data.chunk {
de::ChunkVariants::V1_18 { sections } => { de::ChunkVariant::V1_18 { sections } => {
Self::new_v1_18(data_version, sections, block_types, biome_types) Self::new_v1_18(data_version, sections, block_types, biome_types)
} }
de::ChunkVariants::V0 { level } => { de::ChunkVariant::V0 { level } => {
Self::new_v0(data_version, level, block_types, biome_types) Self::new_v0(data_version, level, block_types, biome_types)
} }
} }
@ -113,7 +113,7 @@ impl<'a> Chunk<'a> {
for section in sections { for section in sections {
match &section.section { match &section.section {
de::SectionV1_18Variants::V1_18 { de::SectionV1_18Variant::V1_18 {
block_states, block_states,
biomes, biomes,
block_light, block_light,
@ -140,7 +140,7 @@ impl<'a> Chunk<'a> {
), ),
); );
} }
de::SectionV1_18Variants::Empty {} => {} de::SectionV1_18Variant::Empty {} => {}
}; };
} }
@ -163,7 +163,7 @@ impl<'a> Chunk<'a> {
format!("Failed to load section block light at Y={}", section.y) format!("Failed to load section block light at Y={}", section.y)
})?; })?;
match &section.section { match &section.section {
de::SectionV0Variants::V1_13 { de::SectionV0Variant::V1_13 {
block_states, block_states,
palette, palette,
} => { } => {
@ -183,7 +183,7 @@ impl<'a> Chunk<'a> {
), ),
); );
} }
de::SectionV0Variants::V0 { blocks, data } => { de::SectionV0Variant::V0 { blocks, data } => {
section_map_v0.insert( section_map_v0.insert(
SectionY(section.y.into()), SectionY(section.y.into()),
( (
@ -194,7 +194,7 @@ impl<'a> Chunk<'a> {
), ),
); );
} }
de::SectionV0Variants::Empty {} => {} de::SectionV0Variant::Empty {} => {}
} }
} }

View file

@ -31,7 +31,7 @@ pub struct BiomesV1_18 {
/// Variable part of a [SectionV1_18] /// Variable part of a [SectionV1_18]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(untagged)] #[serde(untagged)]
pub enum SectionV1_18Variants { pub enum SectionV1_18Variant {
/// Populated 1.18+ section /// Populated 1.18+ section
V1_18 { V1_18 {
/// Block type data /// Block type data
@ -54,13 +54,13 @@ pub struct SectionV1_18 {
pub y: i32, pub y: i32,
/// Variable part of section /// Variable part of section
#[serde(flatten)] #[serde(flatten)]
pub section: SectionV1_18Variants, pub section: SectionV1_18Variant,
} }
/// Version-specific part of a pre-1.18 [Section](SectionV0) /// Version-specific part of a pre-1.18 [Section](SectionV0)
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(untagged)] #[serde(untagged)]
pub enum SectionV0Variants { pub enum SectionV0Variant {
/// v1.13+ data /// v1.13+ data
#[serde(rename_all = "PascalCase")] #[serde(rename_all = "PascalCase")]
V1_13 { V1_13 {
@ -91,7 +91,7 @@ pub struct SectionV0 {
pub block_light: Option<fastnbt::ByteArray>, pub block_light: Option<fastnbt::ByteArray>,
/// Version-specific data /// Version-specific data
#[serde(flatten)] #[serde(flatten)]
pub section: SectionV0Variants, pub section: SectionV0Variant,
} }
/// Pre-1.18 biome fields found in the [Level](LevelV0) compound /// Pre-1.18 biome fields found in the [Level](LevelV0) compound
@ -118,7 +118,7 @@ pub struct LevelV0 {
/// Version-specific part of a [Chunk] compound /// Version-specific part of a [Chunk] compound
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(untagged)] #[serde(untagged)]
pub enum ChunkVariants { pub enum ChunkVariant {
/// 1.18+ chunk data /// 1.18+ chunk data
V1_18 { V1_18 {
/// List of chunk sections /// List of chunk sections
@ -140,7 +140,7 @@ pub struct Chunk {
pub data_version: Option<u32>, pub data_version: Option<u32>,
/// Version-specific chunk data /// Version-specific chunk data
#[serde(flatten)] #[serde(flatten)]
pub chunk: ChunkVariants, pub chunk: ChunkVariant,
} }
/// `Data` compound element of level.dat /// `Data` compound element of level.dat