Merge pull request #8 from nathanruiz/drops

Support pre-1.13 drops format
pull/11/head
Julius Riegel 2 years ago committed by GitHub
commit e2c5de620f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,7 +13,7 @@ pub struct Block {
pub material: Option<String>,
pub harvest_tools: 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