diff --git a/src/models/block.rs b/src/models/block.rs index c0dc07b..9bdf8d6 100644 --- a/src/models/block.rs +++ b/src/models/block.rs @@ -13,7 +13,7 @@ pub struct Block { pub material: Option, pub harvest_tool: Option>, pub variations: Option>, - pub drops: Vec, + pub drops: Vec, pub transparent: bool, pub emit_light: u8, pub filter_light: u8, @@ -40,6 +40,25 @@ pub struct Variation { pub description: Option, } +#[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, + max_count: Option, + } +} + #[derive(Deserialize, Debug, Clone)] // The fields in this part of the schema are not camelCase. #[serde(rename_all(serialize = "snake_case"))]