Skip to content

Commit

Permalink
Version resolver: Add Yarn patch for NeoForge to index
Browse files Browse the repository at this point in the history
  • Loading branch information
Juuxel committed May 11, 2024
1 parent bfb8b54 commit 7c97e63
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
16 changes: 16 additions & 0 deletions version_resolver/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ pub struct Versions {
pub architectury_api: String,
pub forge: Option<String>,
pub neoforge: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub neoforge_yarn_patch: Option<String>,
}

impl Versions {
Expand Down Expand Up @@ -81,10 +83,24 @@ impl Versions {
None
};

let neoforge_yarn_patch = if let Some(prefix) = game_version.neoforge_yarn_patch_version() {
Some(
crate::maven::resolve_matching_version(
&client,
crate::maven::MavenLibrary::neoforge_yarn_patch(),
|version| version.starts_with(&format!("{}+", prefix)),
)
.await?,
)
} else {
None
};

Ok(Self {
architectury_api,
forge,
neoforge,
neoforge_yarn_patch,
})
}
}
4 changes: 4 additions & 0 deletions version_resolver/src/maven.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ impl MavenLibrary {
)
}

pub fn neoforge_yarn_patch() -> Self {
Self::new(MavenRepository::Architectury, "dev.architectury", "yarn-mappings-patch-neoforge")
}

// Forge libraries
pub fn forge() -> Self {
Self::new(MavenRepository::Forge, "net.minecraftforge", "forge")
Expand Down
7 changes: 7 additions & 0 deletions version_resolver/src/minecraft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ impl MinecraftVersion {
}
}

pub fn neoforge_yarn_patch_version(&self) -> Option<&'static str> {
match self {
Self::Minecraft1_20_5 => Some("1.20.5"),
_ => None,
}
}

pub fn forge_pack_version(&self) -> Option<&'static str> {
match self {
Self::Minecraft1_16_5 => Some("6"),
Expand Down

0 comments on commit 7c97e63

Please sign in to comment.