1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use serde::{Deserialize, Serialize};
use std::collections::HashMap;

/// Map of all the assets for a Minecraft version.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct AssetIndexData {
    /// Wether to install the assets as resources or not.
    ///
    /// Used primarily on older versions (pre1.6).
    #[serde(default)]
    pub map_to_resources: bool,
    /// Asset objects.
    ///
    /// Key is the name of the file.
    pub objects: HashMap<String, AssetInfo>,
}

/// Information of a single asset.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct AssetInfo {
    /// SHA1 of the asset file.
    pub hash: String,
    /// Size of the asset file.
    pub size: usize,
}