i added pub t o everything because i didnt know multicursor was a thing in jeetbrains

This commit is contained in:
endernon 2024-11-23 13:48:49 +00:00
parent 440bcf1e36
commit 982d8dcbee
5 changed files with 79 additions and 12 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
/target
.idea

7
Cargo.lock generated Normal file
View file

@ -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"

View file

@ -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"

0
readme.md Normal file
View file

View file

@ -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<McMeta_Filter>,
pub overlays: Option<McMeta_Overlays>,
pub language: Option<Vec<McMeta_Language_Vec>>
}
#[cfg(test)]
mod tests {
use super::*;
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
pub struct McMeta_Pack {
pub description: Vec<McMeta_Pack_Description_Vec>,
pub pack_format: u8,
pub supported_formats: Option<McMeta_Pack_SupportedFormats>
}
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
pub struct McMeta_Pack_Description_Vec {
pub text: String,
pub color: Option<String>
}
#[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<String>
}
// I don't what this looks like either
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
pub struct McMeta_Filter {
pub block: Vec<McMeta_Filter_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<McMeta_Overlays_Entries>
}
#[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
}