Skip to main content

glacier_texture/
lib.rs

1use std::str::FromStr;
2
3pub mod texture_map;
4
5pub mod atlas;
6pub mod box_reflection;
7pub mod convert;
8pub mod enums;
9#[cfg(feature = "image")]
10pub mod image;
11pub mod mipblock;
12pub mod pack;
13#[cfg(feature = "rpkg")]
14pub mod rpkg;
15
16#[non_exhaustive]
17#[derive(Debug, PartialEq, Clone, Copy)]
18pub enum GlacierGame {
19    HM2016,
20    HM2,
21    HM3,
22    KNT,
23}
24
25impl FromStr for GlacierGame {
26    type Err = String;
27    fn from_str(s: &str) -> Result<Self, Self::Err> {
28        match s.to_lowercase().as_str() {
29            "1" | "H1" | "HM1" | "HM2016" | "H2016" => Ok(GlacierGame::HM2016),
30            "2" | "H2" | "HM2" | "HM2018" | "H2018" => Ok(GlacierGame::HM2),
31            "3" | "H3" | "HM3" | "HM2020" | "H2020" => Ok(GlacierGame::HM3),
32            "007" | "KNT" | "BOND" | "FIRSTLIGHT" | "B2026" => Ok(GlacierGame::KNT),
33            _ => Err(format!("Invalid value for GlacierGame: {s}")),
34        }
35    }
36}
37
38pub trait Version {
39    fn get_version() -> GlacierGame;
40}