Support pre-1.13 drops format

pull/8/head
Nathan Ruiz 2 years ago
parent 807b523be2
commit 3920ce90c7

@ -13,7 +13,7 @@ pub struct Block {
pub material: Option<String>,
pub harvest_tool: Option<HashMap<u32, bool>>,
pub variations: Option<Vec<Variation>>,
pub drops: Vec<u32>,
pub drops: Vec<Drop>,
pub transparent: bool,
pub emit_light: u8,
pub filter_light: u8,
@ -40,6 +40,25 @@ pub struct Variation {
pub description: Option<String>,
}
#[derive(Deserialize, Debug, Clone)]
#[serde(untagged)]
pub enum DropId {
Id(u32),
IdWithMetadata { id: u32, metadata: u32 },
}
#[derive(Deserialize, Debug, Clone)]
#[serde(rename_all(deserialize = "camelCase", serialize = "snake_case"))]
#[serde(untagged)]
pub enum Drop {
Id(u32),
DropInfo {
drop: DropId,
min_count: Option<f32>,
max_count: Option<f32>,
}
}
#[derive(Deserialize, Debug, Clone)]
// The fields in this part of the schema are not camelCase.
#[serde(rename_all(serialize = "snake_case"))]

Loading…
Cancel
Save