diff --git a/.gitignore b/.gitignore index ea8c4bf..3a8cabc 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +.idea diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..0246751 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "mcmeta-parser" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index e46e5a3..4b96f12 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,12 @@ [package] name = "mcmeta-parser" -version = "0.1.0" +description = "Library for adding a struct to parse minecraft java edition resource pack pack.mcmeta file" +authors = ["endernon"] +repository = "https://git.frfrnocap.men/mcmeta-parser" +readme = "readme.md" +license = "LGPL-3.0" +version = "0.4.0" edition = "2021" [dependencies] +serde="1.0.215" \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..e69de29 diff --git a/src/lib.rs b/src/lib.rs index b93cf3f..d1e0c07 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,14 +1,67 @@ -pub fn add(left: u64, right: u64) -> u64 { - left + right +use serde::{Serialize,Deserialize}; +#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)] +#[serde()] +pub struct McMeta { + pub pack: McMeta_Pack, + pub features: McMeta_Features, + pub filter: Option, + pub overlays: Option, + pub language: Option> } -#[cfg(test)] -mod tests { - use super::*; + #[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)] + pub struct McMeta_Pack { + pub description: Vec, + pub pack_format: u8, + pub supported_formats: Option + } + #[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)] + pub struct McMeta_Pack_Description_Vec { + pub text: String, + pub color: Option + } + #[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)] + pub struct McMeta_Pack_SupportedFormats { + pub min_inclusive: u8, + pub max_inclusive: u8 + } - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} + // I don't actually know wtf this looks like. I'm guessing based on minecraft wiki + #[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)] + pub struct McMeta_Features { + pub enabled: Vec + } + + // I don't what this looks like either + #[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)] + pub struct McMeta_Filter { + pub block: Vec + } + #[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)] + pub struct McMeta_Filter_Block_Vec { + pub Namespace: String, + pub Path: String + } + + #[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)] + pub struct McMeta_Overlays { + pub entries: Vec + } + + #[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)] + pub struct McMeta_Overlays_Entries { + pub formats: McMeta_Overlays_Entries_Formats, + pub directory: String + } + #[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)] + pub struct McMeta_Overlays_Entries_Formats { + pub min_inclusive: u8, + pub max_inclusive: u8 + } + + #[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)] + pub struct McMeta_Language_Vec { + pub name: String, + pub region: String, + pub bidirectional: bool + } \ No newline at end of file