fujc/minecraft/
modloader.rs

1use serde::{Deserialize, Serialize};
2
3/// Types of Minecraft modloaders.
4/// 
5/// This enum is used to make requests to the CurseForge API.
6/// 
7/// # Variants
8/// 
9/// * `Fabric` - The Fabric modloader.
10/// * `Forge` - The Forge modloader.
11#[derive(Debug, Clone, Copy, Deserialize, Serialize)]
12pub enum ModLoaderType {
13    #[serde(rename = "fabric")]
14    Fabric,
15    #[serde(rename = "forge")]
16    Forge,
17}
18
19impl ModLoaderType {
20    /// Gets the ID of the modloader type.
21    /// 
22    /// # Returns
23    /// 
24    /// The ID of the modloader type.
25    pub fn get_id(&self) -> u32 {
26        match self {
27            ModLoaderType::Fabric => 4,
28            ModLoaderType::Forge => 1,
29        }
30    }
31}