From 35305605819cece46b2c53bdc94cc9de5151bd80 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Thu, 22 Oct 2026 17:28:12 +0200 Subject: [PATCH 1/3] Launcher: Java mods in the mod browser, checked before install; Modpacks moves into Mods The Mods page gets a Mods tab: Fabric, NeoForge, Forge and Quilt mods for 26.3 (1.21 and later with Show everything). Each result's jar is downloaded (allowed CDNs, checksum), checked with horizon-port-pack (Works, Partly, Doesn't run, with what ports and what doesn't) and the answer cached per file. Install copies the carry into horizon-mods// and turns it on in horizon-mods.txt, with required mods that port; libraries with nothing to port are listed as not ported; id or namespace clashes are refused. Remove deletes it and turns it off. The Modpacks page becomes the Mods page's Modpacks tab: imported packs first, then the search. CLI: mods search --kind mod, mods check . Co-Authored-By: Claude Opus 5.5 --- docs/mod-browser.md | 59 +++- launcher/src/browser.rs | 70 ++++- launcher/src/browser/curseforge.rs | 3 +- launcher/src/browser/installed.rs | 43 ++- launcher/src/browser/installed/tests.rs | 2 +- launcher/src/browser/java.rs | 340 ++++++++++++++++++++++++ launcher/src/browser/modrinth.rs | 10 + launcher/src/browser/tests.rs | 55 +++- launcher/src/cli.rs | 70 ++++- launcher/src/main.rs | 5 +- launcher/src/modpacks_page.rs | 33 +-- launcher/src/mods_page.rs | 139 +++++++++- website/docs/modpacks.md | 2 +- website/docs/mods.md | 12 +- 14 files changed, 760 insertions(+), 83 deletions(-) create mode 100644 launcher/src/browser/java.rs diff --git a/docs/mod-browser.md b/docs/mod-browser.md index 115877075..bc7a80b16 100644 --- a/docs/mod-browser.md +++ b/docs/mod-browser.md @@ -1,25 +1,56 @@ # The launcher's mod browser -Search Modrinth (and CurseForge, once the launcher has a key) for packs Horizon loads, see how well each one runs, -and install it with its checksum checked. This is item 16 of the roadmap and issue #577. The code is in +Search Modrinth (and CurseForge, once the launcher has a key) for Java mods, modpacks, resource packs and shader +packs, see how well each one runs before installing it, and install it with its checksum checked. This is item 16 of the roadmap and issue #577. The code is in `launcher/src/browser.rs` and `launcher/src/browser/`. ## What it offers -Only what Horizon actually loads is offered. Java mod jars (Fabric, NeoForge, Forge) don't run in Horizon -([mods.md](mods.md), [research/java-mod-compat.md](research/java-mod-compat.md)), so they are never searched. -Horizon `.hmod` mods aren't on Modrinth or CurseForge yet (Modrinth has no `horizon` loader). +Horizon doesn't run Java code ([research/java-mod-compat.md](research/java-mod-compat.md)). It ports what a Java mod +carries as data (blocks, items, recipes, loot tables, tags, worldgen, textures, names) with `horizon-port-pack`, and +says before install which of the mod's features that leaves out. Horizon `.hmod` mods aren't on Modrinth or CurseForge +yet (Modrinth has no `horizon` loader). | Kind | Goes to | How well it runs | |---|---|---| +| Java mods (Fabric, NeoForge, Forge, Quilt) | ported into `horizon-mods//` and turned on | Checked from its jar before install: **Works**, **Partly** or **Doesn't run** ([below](#java-mods)) | | Resource packs | `resourcepacks/` beside `options.txt` | **Works** when made for 26.3 ([resource-packs.md](resource-packs.md) lists what Horizon reads). Older packs are **Partly**: they load with vanilla's compatibility warning | | Shader packs (Iris, OptiFine) | `shaderpacks/` | **Partly**: translated to WGSL, the full-screen passes draw and the world and shadow passes don't yet ([shader-packs.md](shader-packs.md)). Packs for other loaders (Canvas, core-shader packs) **don't run** and can't be installed | | Modpacks (`.mrpack`, CurseForge zip) | the Modpacks page's import | **Partly**: Horizon runs the mods it can port, from the player's own downloads ([modpacks.md](modpacks.md)) | -By default a search shows only what runs: resource packs made for 26.3, shader packs for Iris or OptiFine, and every -modpack. **Show everything** lists the rest of the kind too, each marked with how well it runs; what doesn't run is +By default a search shows only what runs: Java mods made for 26.3, resource packs made for 26.3, shader packs for Iris +or OptiFine, and every modpack. **Show everything** lists the rest of the kind too, each marked with how well it runs; what doesn't run is never offered for install. +## Java mods + +Before a mod is offered for install, the launcher reads its jar. For each result it picks the version it would +install (the newest for 26.3; with **Show everything**, else the newest for 1.21 or later, the versions port-pack +upgrades from), downloads that file with the checks below, and runs `horizon-port-pack check` on it +([modpacks.md](modpacks.md#the-pipeline-horizon-port-pack)): the jar is carried over into a folder content mod and its +class files are read, not run, for what the carry can't take. Two checks run at once; the row says **Checking** until +its answer comes. + +- **Works**: content only. Its blocks, items, recipes, loot, tags and worldgen port, and its code only registers + them. Blocks take the closest vanilla block's shape, hardness and sounds (a block's numbers live in Java code; the + NeoForge oracle that reads them for modpacks is a developer tool). +- **Partly**: the content ports; the row lists what doesn't: blocks with no vanilla block to copy, recipes of the + mod's own types, block entities (machines, containers), menus, mobs and entities, blocks and items with behaviour + of their own, worldgen written in Java, Mixins, the game events it reacts to. +- **Doesn't run**: nothing to port (performance mods, libraries, everything in code), a jar made for 1.20 or older, + or a mod id with characters Horizon mods can't use (`fabric-api`). Never offered for install. + +The answer is kept in `mod-browser/checks-1//` under the game folder, with the carry when something +ports; the jar itself isn't kept. A file is checked once. On ten 26.3 jars a check took 0.2 to 3 s (24 s for an +18 MB jar with 9,360 recipes). + +**Install** copies the carry into `horizon-mods//`, turns it on in `horizon-mods.txt` (the game's Options > +Mods lists it) and records it in `mod-browser.json` with its verdict and what didn't port, which the Installed list +shows. Its required mods that port are installed with it; one with nothing to port (a library such as Cloth Config +or GeckoLib) is listed as not ported. A mod that shares its id or a namespace with an installed one is refused. The +game reads mod content when it starts: start it again after installing. **Remove** deletes the folder and turns it +off. + ## Checks on every download - The file must come from Modrinth's or CurseForge's file servers (`cdn.modrinth.com`, `edge.forgecdn.net`, @@ -32,10 +63,11 @@ never offered for install. ## The Mods page -The launcher's **Mods** page has the three kinds as tabs, a search field (Enter searches), **Show everything** and, +The launcher's **Mods** page has the four kinds as tabs (Mods, Modpacks, Resource packs, Shader packs), a search field (Enter searches), **Show everything** and, once CurseForge is set up, a Modrinth / CurseForge switch. Each result is an index row: its summary, author, downloads, source and licence, how well it runs (and why), **Page** (the project's page on its source) and -**Install** (**Import** for a modpack). Installed packs are listed above the results with their version, source, +**Install** (**Import** for a modpack). The Modpacks tab lists the imported packs first, with their coverage +report, **Port** and **Play** ([modpacks.md](modpacks.md)). Installed packs are listed above the results with their version, source, file and the checksum they were checked against, with **Update to …** when a newer version runs and **Remove** (asked twice). @@ -51,14 +83,15 @@ same name the player put there is never overwritten. Packs, as in vanilla and Iris. - **Update** installs the newer version and removes the old file. - **Remove** deletes the file and its entry. Packs installed as dependencies stay. -- **A modpack** is downloaded (checked the same way) into `ports/downloads/` and imported on the Modpacks page, - which says what of it Horizon runs and ports it. +- **A modpack** is downloaded (checked the same way) into `ports/downloads/` and imported; the Modpacks tab says + what of it Horizon runs and ports it. From a terminal (or an agent): ```sh -horizon-launcher mods search faithful # --kind resource|shader|modpack, --everything, --source -horizon-launcher mods install faithful-32x # id or slug; a modpack is imported +horizon-launcher mods search faithful # --kind mod|modpack|resource|shader, --everything, --source +horizon-launcher mods check macaws-fences-and-walls # a Java mod's verdict, what ports and what doesn't (--json) +horizon-launcher mods install faithful-32x # id or slug; a Java mod is ported, a modpack imported horizon-launcher mods list # --json horizon-launcher mods update [faithful-32x] [--check] horizon-launcher mods remove faithful-32x diff --git a/launcher/src/browser.rs b/launcher/src/browser.rs index 49ec1e696..b8248fd7c 100644 --- a/launcher/src/browser.rs +++ b/launcher/src/browser.rs @@ -2,12 +2,14 @@ //! Horizon loads, say how well each result runs, and download a file only after its checksum //! matches (docs/mod-browser.md). //! -//! Only what Horizon actually loads is offered: resource packs (`resourcepacks/`), Java shader -//! packs (`shaderpacks/`, Iris and OptiFine) and modpacks (imported and ported on the Modpacks -//! page). Java mod jars don't run in Horizon (docs/mods.md), so they are never searched. +//! Offered: Java mods (Fabric, NeoForge, Forge), whose content Horizon ports and whose jar is +//! checked before install ([`java`]), modpacks (imported and ported), resource packs +//! (`resourcepacks/`) and Java shader packs (`shaderpacks/`, Iris and OptiFine). Java code itself +//! doesn't run in Horizon (docs/mods.md). pub mod curseforge; pub mod download; pub mod installed; +pub mod java; pub mod modrinth; use serde::{Deserialize, Serialize}; @@ -23,25 +25,34 @@ pub enum Kind { ResourcePack, ShaderPack, Modpack, + /// A Java mod: its content is ported ([`java`]). + Mod, } impl Kind { - pub const ALL: [Kind; 3] = [Kind::ResourcePack, Kind::ShaderPack, Kind::Modpack]; + pub const ALL: [Kind; 4] = [ + Kind::Mod, + Kind::Modpack, + Kind::ResourcePack, + Kind::ShaderPack, + ]; pub fn label(self) -> &'static str { match self { + Kind::Mod => "Mods", Kind::ResourcePack => "Resource packs", Kind::ShaderPack => "Shader packs", Kind::Modpack => "Modpacks", } } - /// The folder beside `options.txt` the file goes in; a modpack is imported instead. + /// The folder beside `options.txt` the file goes in; a modpack is imported and a mod + /// ported instead. pub fn folder(self) -> Option<&'static str> { match self { Kind::ResourcePack => Some("resourcepacks"), Kind::ShaderPack => Some("shaderpacks"), - Kind::Modpack => None, + Kind::Modpack | Kind::Mod => None, } } } @@ -256,11 +267,34 @@ pub fn support(kind: Kind, game_versions: &[String], loaders: &[String]) -> Supp )) } } - Kind::Modpack => Support::Partial( - "Imported on the Modpacks page: Horizon runs the mods it can port, from your own \ - downloads." - .into(), - ), + Kind::Modpack => { + Support::Partial("Horizon runs the mods it can port, from your own downloads.".into()) + } + Kind::Mod => { + if !loaders.iter().any(|l| java::LOADERS.contains(&l.as_str())) { + Support::No("Not a Fabric, NeoForge or Forge mod.".into()) + } else if !game_versions.iter().any(|v| portable_version(v)) { + let newest = newest_release(game_versions).unwrap_or("an unknown version"); + Support::No(format!( + "Made for {newest}: Horizon ports mods made for 1.21 and later." + )) + } else { + Support::Partial( + "Not checked yet: the launcher reads its jar to say what of it ports.".into(), + ) + } + } + } +} + +/// A Minecraft version whose mods port-pack carries over: 1.21 and later (the data folders +/// took their current names in 1.21). +pub fn portable_version(v: &str) -> bool { + let parts: Vec = v.split('.').map_while(|p| p.parse().ok()).collect(); + match parts.as_slice() { + [1, minor, ..] => *minor >= 21 && v.split('.').count() == parts.len(), + [year, ..] => *year >= 26 && v.split('.').count() == parts.len(), + [] => false, } } @@ -286,6 +320,20 @@ pub fn pick(kind: Kind, versions: &[Version], everything: bool) -> Option<&Versi let mut usable = versions .iter() .filter(|v| v.blocked.is_none() && v.file().is_some()); + if kind == Kind::Mod { + let java = |v: &&Version| { + v.loaders + .iter() + .any(|l| java::LOADERS.contains(&l.as_str())) + }; + let made_for = |v: &&Version| v.game_versions.iter().any(|g| g == GAME); + let ported = |v: &&Version| v.game_versions.iter().any(|g| portable_version(g)); + return usable + .clone() + .filter(java) + .find(made_for) + .or_else(|| usable.filter(java).find(|v| everything && ported(v))); + } let runs = |v: &&Version| match support(kind, &v.game_versions, &v.loaders) { Support::Works => true, // A modpack's version is for its own Minecraft; any shader pack Horizon translates. diff --git a/launcher/src/browser/curseforge.rs b/launcher/src/browser/curseforge.rs index 347cf0d40..04e722bba 100644 --- a/launcher/src/browser/curseforge.rs +++ b/launcher/src/browser/curseforge.rs @@ -24,6 +24,7 @@ fn class(kind: Kind) -> u64 { Kind::ResourcePack => 12, Kind::ShaderPack => 6552, Kind::Modpack => 4471, + Kind::Mod => 6, } } @@ -73,7 +74,7 @@ pub(super) fn search_url(query: &Query) -> String { query.offset, query.limit.clamp(1, 50), ); - if !query.everything && query.kind == Kind::ResourcePack { + if !query.everything && matches!(query.kind, Kind::ResourcePack | Kind::Mod) { url.push_str(&format!("&gameVersion={GAME}")); } if !query.text.is_empty() { diff --git a/launcher/src/browser/installed.rs b/launcher/src/browser/installed.rs index d1aac1af5..1ed9b3cf8 100644 --- a/launcher/src/browser/installed.rs +++ b/launcher/src/browser/installed.rs @@ -1,7 +1,8 @@ //! What the browser installed into the game folder, and installing, updating and removing it. //! //! `mod-browser.json` beside `options.txt` lists each file the browser put in `resourcepacks/` -//! or `shaderpacks/`: where it came from, its version and its checksum. Files the player put +//! or `shaderpacks/`, and each Java mod it ported into `horizon-mods/`: where it came from, its +//! version and its checksum. Files the player put //! there themselves are never touched: the browser only replaces or removes what it lists. use super::{pick, safe_name, Kind, Project, Source, SourceId, Support, Version}; use serde::{Deserialize, Serialize}; @@ -29,6 +30,15 @@ pub struct Entry { /// Installed because another pack needs it. #[serde(default)] pub dependency: bool, + /// A Java mod's verdict when it was installed: `Works` or `Partly`. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub verdict: Option, + /// What of a Java mod didn't port. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub skipped: Vec, + /// A Java mod's namespaces: two installed mods never share one. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub namespaces: Vec, } #[derive(Debug, Default, Serialize, Deserialize)] @@ -78,9 +88,15 @@ pub struct Step { /// What installing `project` takes, dependencies first, checked before any byte is downloaded: /// every file runs in Horizon and has a version to install. pub fn plan(source: &dyn Source, project: &Project, everything: bool) -> Result, String> { + if project.kind == Kind::Modpack { + return Err(format!( + "{} is a modpack: it is imported, not installed.", + project.title + )); + } if project.kind.folder().is_none() { return Err(format!( - "{} is a modpack: it is imported on the Modpacks page.", + "{} is ported, not installed as a file.", project.title )); } @@ -122,10 +138,7 @@ fn add( ) })?; if needed.kind.folder().is_none() { - return Err(format!( - "{} needs the modpack {}.", - project.title, needed.title - )); + return Err(format!("{} needs {}.", project.title, needed.title)); } add(source, needed, everything, true, depth + 1, steps)?; } @@ -146,6 +159,9 @@ pub fn install( home: &Path, progress: &dyn Fn(&str, f32), ) -> Result, String> { + if project.kind == Kind::Mod { + return super::java::install(source, project, everything, home, progress); + } let steps = plan(source, project, everything)?; let mut installed = Installed::load(home); let mut done = Vec::new(); @@ -199,6 +215,9 @@ pub fn install( page: p.page.clone(), // Asked for by the player once: it stays theirs. dependency: step.dependency && old.as_ref().is_none_or(|o| o.dependency), + verdict: None, + skipped: Vec::new(), + namespaces: Vec::new(), }; debug_assert!(path.ends_with(name)); installed @@ -218,10 +237,14 @@ pub fn remove(home: &Path, name: &str) -> Result { .lookup(name) .cloned() .ok_or_else(|| format!("{name} wasn't installed by the browser."))?; - match fs::remove_file(home.join(&entry.file)) { - Ok(()) => {} - Err(e) if e.kind() == std::io::ErrorKind::NotFound => {} - Err(e) => return Err(format!("{}: {e}", entry.file)), + if entry.kind == Kind::Mod { + super::java::remove(home, &entry)?; + } else { + match fs::remove_file(home.join(&entry.file)) { + Ok(()) => {} + Err(e) if e.kind() == std::io::ErrorKind::NotFound => {} + Err(e) => return Err(format!("{}: {e}", entry.file)), + } } installed .entries diff --git a/launcher/src/browser/installed/tests.rs b/launcher/src/browser/installed/tests.rs index 33dc525ab..af55ec78d 100644 --- a/launcher/src/browser/installed/tests.rs +++ b/launcher/src/browser/installed/tests.rs @@ -227,7 +227,7 @@ fn nothing_is_installed_when_a_check_fails() { let pack = project("pack", Kind::Modpack); assert!(plan(&fake, &pack, false) .unwrap_err() - .contains("Modpacks page")); + .contains("imported, not installed")); fs::remove_dir_all(&home).unwrap(); } diff --git a/launcher/src/browser/java.rs b/launcher/src/browser/java.rs new file mode 100644 index 000000000..76ce43c95 --- /dev/null +++ b/launcher/src/browser/java.rs @@ -0,0 +1,340 @@ +//! Java mods (Fabric, NeoForge, Forge) from the browser (docs/mod-browser.md). Horizon doesn't +//! run their code; it ports what they carry (blocks, items, recipes, loot, tags, worldgen) with +//! `horizon-port-pack`. Before a mod is offered for install its jar is downloaded (checked as +//! every download is), carried over and its classes read (`horizon_port_pack::check`): the +//! verdict (Works, Partly, Doesn't run) and the lists of what ports and what doesn't come from +//! that, and are kept per file so a jar is checked once. +//! +//! Installing copies the carried-over folder mod into `horizon-mods//` beside +//! `options.txt` and turns it on in `horizon-mods.txt`, where the game's Options > Mods reads it. +use super::{installed::Entry, pick, FileRef, Kind, Project, Source, Support, Version}; +use horizon_port_pack::check::{self, Check, Verdict}; +use std::fs; +use std::path::{Path, PathBuf}; + +/// Where the checks are kept, under the game folder. Its name changes when the check finds +/// more, so older answers are checked again. +const CHECKS: &str = "mod-browser/checks-1"; +/// The game's mod folder and on-list, beside `options.txt` (`horizon_client::mod_list`). +pub const MODS_DIR: &str = "horizon-mods"; +const MODS_LIST: &str = "horizon-mods.txt"; +/// How deep required mods are followed. +const MAX_DEPTH: usize = 3; + +/// The loaders whose jars port-pack reads. +pub const LOADERS: [&str; 4] = ["neoforge", "fabric", "forge", "quilt"]; + +/// How well a checked mod runs. +pub fn support_of(check: &Check) -> Support { + match check.verdict { + Verdict::Works => Support::Works, + Verdict::Partly => Support::Partial(check.summary.clone()), + Verdict::No => Support::No(check.summary.clone()), + } +} + +fn checks(home: &Path) -> PathBuf { + home.join(CHECKS) +} + +/// The folder a file's check is kept in, by its checksum. +fn checked_dir(home: &Path, file: &FileRef) -> Option { + let (_, hash) = file.checksum()?; + let hash: String = hash + .chars() + .filter(char::is_ascii_hexdigit) + .take(40) + .collect(); + (hash.len() >= 32).then(|| checks(home).join(hash)) +} + +fn read_check(dir: &Path) -> Option { + serde_json::from_str(&fs::read_to_string(dir.join("check.json")).ok()?).ok() +} + +/// The check of `file` if it was made before. +pub fn cached(home: &Path, file: &FileRef) -> Option { + read_check(&checked_dir(home, file)?) +} + +/// Checks `file`: the cached answer, else its jar downloaded, carried over and read. The jar +/// itself isn't kept; the carry is, when something of it ports, for the install to copy. +pub fn check_file( + home: &Path, + source: &dyn Source, + file: &FileRef, + progress: &dyn Fn(f32), +) -> Result { + let dir = checked_dir(home, file).ok_or("Its source gives no checksum.")?; + if let Some(c) = read_check(&dir) { + return Ok(c); + } + let jar = source.fetch(file, &checks(home).join(".downloads"), progress)?; + let part = dir.with_extension("part"); + let _ = fs::remove_dir_all(&part); + let result = check::check(&jar, &part); + let _ = fs::remove_file(&jar); + let c = result.inspect_err(|_| { + let _ = fs::remove_dir_all(&part); + })?; + if c.verdict == Verdict::No { + for d in ["carry", "outside"] { + let _ = fs::remove_dir_all(part.join(d)); + } + } + let _ = fs::remove_dir_all(&dir); + fs::rename(&part, &dir).map_err(|e| format!("{}: {e}", dir.display()))?; + Ok(c) +} + +/// The version of `project` to install and its check. +pub fn check_project( + home: &Path, + source: &dyn Source, + project: &Project, + everything: bool, + progress: &dyn Fn(f32), +) -> Result<(Version, Check), String> { + let versions = source.versions(project)?; + let version = pick(Kind::Mod, &versions, everything) + .cloned() + .ok_or_else(|| match versions.iter().find_map(|v| v.blocked.clone()) { + Some(why) => format!("{} can't be downloaded from here: {why}", project.title), + None => format!( + "{} has no Fabric, NeoForge or Forge version Horizon can port.", + project.title + ), + })?; + let file = version.file().expect("pick keeps versions with a file"); + let check = check_file(home, source, file, progress)?; + Ok((version, check)) +} + +/// Turns mod `id` on (or off) in `horizon-mods.txt`, keeping the other lines. +pub fn set_enabled(home: &Path, id: &str, on: bool) -> Result<(), String> { + let path = home.join(MODS_LIST); + let text = fs::read_to_string(&path).unwrap_or_default(); + let key = format!("mod.{id}"); + let mut lines: Vec = text + .lines() + .filter(|l| l.split_once(':').is_none_or(|(k, _)| k.trim() != key)) + .map(str::to_owned) + .collect(); + if on { + lines.push(format!("{key}:true")); + } + let mut out = lines.join("\n"); + if !out.is_empty() { + out.push('\n'); + } + fs::write(&path, out).map_err(|e| format!("{}: {e}", path.display())) +} + +fn copy_dir(from: &Path, to: &Path) -> Result<(), String> { + fs::create_dir_all(to).map_err(|e| format!("{}: {e}", to.display()))?; + for entry in fs::read_dir(from).map_err(|e| format!("{}: {e}", from.display()))? { + let entry = entry.map_err(|e| e.to_string())?; + let (src, dst) = (entry.path(), to.join(entry.file_name())); + if entry.file_type().map_err(|e| e.to_string())?.is_dir() { + copy_dir(&src, &dst)?; + } else { + fs::copy(&src, &dst).map_err(|e| format!("{}: {e}", dst.display()))?; + } + } + Ok(()) +} + +/// Installs the Java mod `project`: checked, carried over into `horizon-mods//` and turned +/// on, with the mods it requires that port too. A required mod with nothing to port (a library) +/// is listed in what was skipped. Returns the entries installed, the asked-for one last. +pub fn install( + source: &dyn Source, + project: &Project, + everything: bool, + home: &Path, + progress: &dyn Fn(&str, f32), +) -> Result, String> { + let job = Job { + source, + everything, + home, + progress, + }; + let mut done = Vec::new(); + job.add(project, false, 0, &mut done)?; + Ok(done) +} + +/// One install: where from, where to, and how it reports. +struct Job<'a> { + source: &'a dyn Source, + everything: bool, + home: &'a Path, + progress: &'a dyn Fn(&str, f32), +} + +impl Job<'_> { + fn add( + &self, + project: &Project, + dependency: bool, + depth: usize, + done: &mut Vec, + ) -> Result<(), String> { + let Job { + source, + everything, + home, + progress, + } = *self; + if done.iter().any(|e| e.project == project.id) { + return Ok(()); + } + let (version, check) = check_project(home, source, project, everything, &|f| { + progress(&format!("Checking {}", project.title), f) + })?; + if check.verdict == Verdict::No { + return Err(format!( + "{} doesn't run in Horizon: {}", + project.title, check.summary + )); + } + let mut skipped = check.skipped.clone(); + for id in &version.required { + let Ok(needed) = source.project(id) else { + continue; + }; + if needed.kind != Kind::Mod || depth >= MAX_DEPTH { + continue; + } + match self.add(&needed, true, depth + 1, done) { + Ok(()) => {} + Err(_) if dependency => {} + Err(why) => skipped.push(format!("needs {}: {why}", needed.title)), + } + } + let file = version.file().expect("pick keeps versions with a file"); + let carry = checked_dir(home, file) + .expect("checked above") + .join("carry"); + let relative = format!("{MODS_DIR}/{}", check.mod_id); + let mut installed = super::installed::Installed::load(home); + let ours = |e: &Entry| e.source == project.source && e.project == project.id; + if let Some(other) = installed.entries.iter().find(|e| { + e.kind == Kind::Mod + && !ours(e) + && (e.file == relative || e.namespaces.iter().any(|n| check.namespaces.contains(n))) + }) { + return Err(format!( + "{} shares its id or namespace with {}, installed already: remove one first.", + project.title, other.title + )); + } + let target = home.join(&relative); + let old = installed.entries.iter().find(|e| ours(e)).cloned(); + if target.exists() && old.as_ref().is_none_or(|o| o.file != relative) { + return Err(format!( + "{relative} is already there and wasn't installed by the browser: move it away first." + )); + } + progress(&format!("Installing {}", project.title), 1.); + let part = home.join(MODS_DIR).join(format!(".{}.part", check.mod_id)); + let _ = fs::remove_dir_all(&part); + copy_dir(&carry, &part).inspect_err(|_| { + let _ = fs::remove_dir_all(&part); + })?; + if let Some(old) = &old { + let _ = fs::remove_dir_all(home.join(&old.file)); + if old.file != relative { + let _ = set_enabled(home, old.file.trim_start_matches("horizon-mods/"), false); + } + } + fs::rename(&part, &target).map_err(|e| format!("{}: {e}", target.display()))?; + set_enabled(home, &check.mod_id, true)?; + let (algo, hash) = file.checksum().expect("checked files have one"); + let entry = Entry { + source: project.source, + project: project.id.clone(), + slug: project.slug.clone(), + title: project.title.clone(), + kind: Kind::Mod, + version: version.id.clone(), + number: version.number.clone(), + file: relative, + checksum: format!("{algo}:{hash}"), + page: project.page.clone(), + dependency: dependency && old.as_ref().is_none_or(|o| o.dependency), + verdict: Some(check.verdict.label().to_owned()), + skipped, + namespaces: check.namespaces.clone(), + }; + installed.entries.retain(|e| !ours(e)); + installed.entries.push(entry.clone()); + installed.save(home)?; + done.push(entry); + Ok(()) + } +} + +/// Removes an installed mod's folder and turns it off. +pub fn remove(home: &Path, entry: &Entry) -> Result<(), String> { + let Some(id) = entry.file.strip_prefix("horizon-mods/") else { + return Err(format!("{} isn't in {MODS_DIR}/.", entry.file)); + }; + match fs::remove_dir_all(home.join(&entry.file)) { + Ok(()) => {} + Err(e) if e.kind() == std::io::ErrorKind::NotFound => {} + Err(e) => return Err(format!("{}: {e}", entry.file)), + } + set_enabled(home, id, false) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn the_on_list_keeps_other_lines() { + let home = std::env::temp_dir().join(format!("horizon-java-mods-{}", std::process::id())); + let _ = fs::remove_dir_all(&home); + fs::create_dir_all(&home).unwrap(); + fs::write( + home.join(MODS_LIST), + "mod.coords_hud:true\nmod.ruby:false\n", + ) + .unwrap(); + set_enabled(&home, "ruby", true).unwrap(); + set_enabled(&home, "gem", true).unwrap(); + assert_eq!( + fs::read_to_string(home.join(MODS_LIST)).unwrap(), + "mod.coords_hud:true\nmod.ruby:true\nmod.gem:true\n" + ); + set_enabled(&home, "ruby", false).unwrap(); + set_enabled(&home, "gem", false).unwrap(); + assert_eq!( + fs::read_to_string(home.join(MODS_LIST)).unwrap(), + "mod.coords_hud:true\n" + ); + fs::remove_dir_all(&home).unwrap(); + } + + #[test] + fn checks_are_kept_by_checksum() { + let home = Path::new("/h"); + let file = |sha512: Option<&str>, sha1: Option<&str>| FileRef { + url: String::new(), + name: "a.jar".into(), + size: 1, + sha512: sha512.map(str::to_owned), + sha1: sha1.map(str::to_owned), + primary: true, + }; + let long = "ab".repeat(64); + assert_eq!( + checked_dir(home, &file(Some(&long), None)).unwrap(), + home.join(CHECKS).join("ab".repeat(20)) + ); + assert!(checked_dir(home, &file(None, Some("../../etc"))).is_none()); + assert!(checked_dir(home, &file(None, None)).is_none()); + } +} diff --git a/launcher/src/browser/modrinth.rs b/launcher/src/browser/modrinth.rs index e7e39628a..77b5475bb 100644 --- a/launcher/src/browser/modrinth.rs +++ b/launcher/src/browser/modrinth.rs @@ -13,6 +13,7 @@ fn project_type(kind: Kind) -> &'static str { Kind::ResourcePack => "resourcepack", Kind::ShaderPack => "shader", Kind::Modpack => "modpack", + Kind::Mod => "mod", } } @@ -32,8 +33,17 @@ pub(super) fn facets(query: &Query) -> String { all.push(vec!["categories:iris".into(), "categories:optifine".into()]) } Kind::Modpack => {} + Kind::Mod => all.push(vec![format!("versions:{GAME}")]), } } + if query.kind == Kind::Mod { + all.push( + super::java::LOADERS + .iter() + .map(|l| format!("categories:{l}")) + .collect(), + ); + } serde_json::to_string(&all).unwrap_or_default() } diff --git a/launcher/src/browser/tests.rs b/launcher/src/browser/tests.rs index ced342d13..9e75c55a1 100644 --- a/launcher/src/browser/tests.rs +++ b/launcher/src/browser/tests.rs @@ -140,6 +140,42 @@ fn modrinth_search_asks_for_what_runs() { modrinth::facets(&Query::new("", Kind::Modpack)), r#"[["project_type:modpack"]]"# ); + assert_eq!( + modrinth::facets(&Query::new("", Kind::Mod)), + r#"[["project_type:mod"],["versions:26.3"],["categories:neoforge","categories:fabric","categories:forge","categories:quilt"]]"# + ); +} + +#[test] +fn java_mods_are_checked_for_1_21_and_later() { + assert_eq!( + support(Kind::Mod, &v(&["1.20.1"]), &v(&["forge"])), + Support::No("Made for 1.20.1: Horizon ports mods made for 1.21 and later.".into()) + ); + assert!(!support(Kind::Mod, &v(&[GAME]), &v(&["rift"])).installable()); + assert!(matches!( + support(Kind::Mod, &v(&["1.21.1"]), &v(&["neoforge"])), + Support::Partial(_) + )); + for (version, ok) in [ + ("1.21", true), + ("1.21.11", true), + ("26.3", true), + ("1.20.6", false), + ("26.1-snapshot-2", false), + ("", false), + ] { + assert_eq!(portable_version(version), ok, "{version}"); + } + let versions = [ + version("snapshot", &["26.4-snapshot-1"], &["fabric"]), + version("shaders", &[GAME], &["iris"]), + version("now", &[GAME], &["neoforge"]), + version("older", &["1.21.1"], &["neoforge"]), + ]; + assert_eq!(pick(Kind::Mod, &versions, false).unwrap().id, "now"); + assert_eq!(pick(Kind::Mod, &versions[3..], false), None); + assert_eq!(pick(Kind::Mod, &versions[3..], true).unwrap().id, "older"); } #[test] @@ -157,9 +193,16 @@ fn modrinth_answers() { assert_eq!(p.page, "https://modrinth.com/resourcepack/fresh-animations"); assert_eq!(p.support(), Support::Works); assert_eq!(p.downloads, 51404735); - // A Java mod is never a result. - let jar = json!({"project_id": "AANobbMI", "project_type": "mod", "slug": "sodium"}); - assert!(modrinth::parse_hit(&jar).is_none()); + // A Java mod is a result, checked before it is offered. + let jar = json!({"project_id": "AANobbMI", "project_type": "mod", "slug": "sodium", + "versions": ["26.3"], "categories": ["fabric", "optimization"]}); + let sodium = modrinth::parse_hit(&jar).unwrap(); + assert_eq!(sodium.kind, Kind::Mod); + assert_eq!(sodium.page, "https://modrinth.com/mod/sodium"); + assert!(matches!(sodium.support(), Support::Partial(_))); + // Data packs and plugins are not. + let plugin = json!({"project_id": "x", "project_type": "plugin", "slug": "p"}); + assert!(modrinth::parse_hit(&plugin).is_none()); let project = json!({ "id": "HVnmMxH1", "project_type": "shader", "slug": "complementary-reimagined", @@ -243,7 +286,11 @@ fn curseforge_answers() { assert_eq!(p.loaders, ["iris", "optifine"]); assert_eq!(p.author, "CaptTatsu"); assert!(p.support().installable()); - assert!(curseforge::parse_mod(&json!({"id": 1, "classId": 6})).is_none()); + assert_eq!( + curseforge::parse_mod(&json!({"id": 1, "classId": 6})).map(|p| p.kind), + Some(Kind::Mod) + ); + assert!(curseforge::parse_mod(&json!({"id": 1, "classId": 17})).is_none()); let file = json!({ "id": 5000, "displayName": "BSL v10", "fileName": "BSL_v10.zip", "fileLength": 300, diff --git a/launcher/src/cli.rs b/launcher/src/cli.rs index e498fed2b..530d220dd 100644 --- a/launcher/src/cli.rs +++ b/launcher/src/cli.rs @@ -170,8 +170,18 @@ enum ModsCmd { #[arg(long, value_enum, default_value_t = SourceArg::Modrinth)] source: SourceArg, }, - /// Install a pack and what it needs, by its id or slug (checksums checked); a modpack is - /// imported on the Modpacks page + /// Say how well a Java mod runs in Horizon: its jar is downloaded (checksum checked), + /// carried over and read; the answer is kept + Check { + project: String, + /// Allow a version made for another Minecraft version (1.21 and later) + #[arg(long)] + everything: bool, + #[arg(long, value_enum, default_value_t = SourceArg::Modrinth)] + source: SourceArg, + }, + /// Install a pack and what it needs, by its id or slug (checksums checked); a Java mod is + /// ported into horizon-mods and turned on; a modpack is imported Install { project: String, /// Allow a version made for another Minecraft version @@ -193,6 +203,7 @@ enum ModsCmd { #[derive(Clone, Copy, clap::ValueEnum)] enum KindArg { + Mod, Resource, Shader, Modpack, @@ -950,6 +961,7 @@ fn mods(action: ModsCmd, as_json: bool) -> Result<(), String> { KindArg::Resource => Kind::ResourcePack, KindArg::Shader => Kind::ShaderPack, KindArg::Modpack => Kind::Modpack, + KindArg::Mod => Kind::Mod, }; let query = Query { everything, @@ -968,20 +980,67 @@ fn mods(action: ModsCmd, as_json: bool) -> Result<(), String> { } else { for p in &found { let support = p.support(); + let unchecked = p.kind == Kind::Mod && support.installable(); println!( "{} ({}) {} · {} downloads\n {}", p.title, p.slug, - support.label(), + if unchecked { + "Not checked" + } else { + support.label() + }, p.downloads, p.summary ); - if let Some(why) = support.reason() { + if unchecked { + println!(" horizon-launcher mods check {}", p.slug); + } else if let Some(why) = support.reason() { println!(" {why}"); } } } } + ModsCmd::Check { + project, + everything, + source, + } => { + let source = source.get()?; + let p = source.project(&project)?; + if p.kind != Kind::Mod { + return Err(format!("{} isn't a Java mod.", p.title)); + } + let (version, c) = horizon_launcher::browser::java::check_project( + &home, + &*source, + &p, + everything, + &progress(p.title.clone()), + )?; + if as_json { + let mut v = serde_json::to_value(&c).unwrap_or_default(); + v["version"] = version.number.clone().into(); + v["label"] = c.verdict.label().into(); + println!("{v}"); + return Ok(()); + } + println!( + "{} {} ({} {}): {}. {}", + p.title, + version.number, + c.loader, + c.mod_id, + c.verdict.label(), + c.summary + ); + for line in &c.ports { + println!(" ports: {line}"); + } + for line in &c.skipped { + println!(" doesn't: {line}"); + } + } ModsCmd::Install { project, everything, @@ -1009,6 +1068,9 @@ fn mods(action: ModsCmd, as_json: bool) -> Result<(), String> { } for e in done.iter().filter(|_| !as_json) { println!("{} {}: {} ({})", e.title, e.number, e.file, e.checksum); + for s in &e.skipped { + println!(" not ported: {s}"); + } } } ModsCmd::Update { project, check } => { diff --git a/launcher/src/main.rs b/launcher/src/main.rs index c1184fe10..bb1e8dceb 100644 --- a/launcher/src/main.rs +++ b/launcher/src/main.rs @@ -37,18 +37,16 @@ enum Page { Play, Versions, Mods, - Modpacks, Servers, Notes, Settings, } impl Page { - const ALL: [(Page, &'static str); 7] = [ + const ALL: [(Page, &'static str); 6] = [ (Page::Play, "Play"), (Page::Versions, "Versions"), (Page::Mods, "Mods"), - (Page::Modpacks, "Modpacks"), (Page::Servers, "Servers"), (Page::Notes, "Patch notes"), (Page::Settings, "Settings"), @@ -2788,7 +2786,6 @@ impl Render for Launcher { Page::Play => self.play_page(cx), Page::Versions => self.versions_page(cx), Page::Mods => self.mods_page(cx), - Page::Modpacks => self.modpacks_page(cx), Page::Servers => self.servers_page(cx), Page::Notes => self.notes_page(cx), Page::Settings => self.settings_page(cx), diff --git a/launcher/src/modpacks_page.rs b/launcher/src/modpacks_page.rs index 2398421c6..b776321b3 100644 --- a/launcher/src/modpacks_page.rs +++ b/launcher/src/modpacks_page.rs @@ -1,5 +1,5 @@ -//! The Modpacks page: import a pack, read its coverage report, port what this computer can and -//! play it as its own profile (`horizon_launcher::modpacks`). +//! Imported modpacks, on the Mods page's Modpacks tab: import a pack, read its coverage report, +//! port what this computer can and play it as its own profile (`horizon_launcher::modpacks`). use super::*; use horizon_launcher::modpacks::{self, Imported}; use horizon_port_pack::report::Status; @@ -124,7 +124,8 @@ impl Launcher { self.start_client(tag); } - pub(super) fn modpacks_page(&mut self, cx: &mut Context) -> Div { + /// The imported packs, above the Modpacks tab's search. + pub(super) fn imported_packs(&mut self, cx: &mut Context) -> Div { let t = self.theme; if self.packs_loaded.is_none() { self.packs = modpacks::list(); @@ -133,12 +134,6 @@ impl Launcher { } self.packs_loaded = Some(Instant::now()); } - let header = page_header( - "Modpacks", - "Bring a Java modpack: see what Horizon runs of it, port that on this computer from \ - your own downloads, and play it as its own profile. Nothing is uploaded or shared.", - &t, - ); let busy = self.pack_busy; let pick = |id: &'static str, label: &'static str, folder: bool| { let b = button(id, label, Kind::Secondary, &t); @@ -159,14 +154,11 @@ impl Launcher { .child(pick("import-file", "Import a pack file…", false)) .child(pick("import-folder", "Import an instance folder…", true)) .child(text(theme::CAPTION).text_color(t.muted).child( - ".mrpack (Modrinth), .zip (CurseForge), or a Prism, MultiMC or CurseForge instance", + ".mrpack (Modrinth), .zip (CurseForge), or a Prism, MultiMC or CurseForge instance. \ + Horizon ports what it can on this computer, from your own downloads, and plays \ + the pack as its own profile. Nothing is uploaded or shared.", )); - let mut page = div() - .flex() - .flex_col() - .gap(px(32.)) - .child(header) - .child(actions); + let mut page = div().flex().flex_col().gap(px(32.)).child(actions); if busy || !self.pack_log.is_empty() { page = page.child(self.pack_log_plate(&t)); } @@ -174,10 +166,11 @@ impl Launcher { page = page.child(notice(e.clone(), &t)); } if self.packs.is_empty() { - return page.child(centered( - "No modpack yet. Import one to see what Horizon can run of it.", - &t, - )); + return page.child( + text(theme::CAPTION) + .text_color(t.muted) + .child("No modpack imported yet: import one, or find one below."), + ); } if self.packs.len() > 1 { let mut list = div().flex().flex_col().border_t_1().border_color(t.rule); diff --git a/launcher/src/mods_page.rs b/launcher/src/mods_page.rs index 25a825c93..136ca7953 100644 --- a/launcher/src/mods_page.rs +++ b/launcher/src/mods_page.rs @@ -1,19 +1,25 @@ -//! The Mods page: search Modrinth (and CurseForge with a key) for resource packs, shader packs -//! and modpacks Horizon loads, see where each comes from and how well it runs, install it with -//! its checksum checked, and update or remove what was installed (`horizon_launcher::browser`). +//! The Mods page: search Modrinth (and CurseForge with a key) for Java mods, modpacks, resource +//! packs and shader packs, see where each comes from and how well it runs (a Java mod's jar is +//! checked first), install it with its checksum checked, and update or remove what was installed +//! (`horizon_launcher::browser`). Imported modpacks are listed on its Modpacks tab. use super::servers_page::{type_key, Key}; use super::*; use horizon_launcher::browser::{ - self, curseforge::CurseForge, installed, Kind as PackKind, Project, Query, SourceId, Support, + self, curseforge::CurseForge, installed, java, Kind as PackKind, Project, Query, SourceId, + Support, }; use horizon_launcher::modpacks; +use horizon_port_pack::check::Check; use std::collections::HashMap; -const KINDS: [(PackKind, &str); 3] = [ +const KINDS: [(PackKind, &str); 4] = [ + (PackKind::Mod, "Mods"), + (PackKind::Modpack, "Modpacks"), (PackKind::ResourcePack, "Resource packs"), (PackKind::ShaderPack, "Shader packs"), - (PackKind::Modpack, "Modpacks"), ]; +/// Java mods checked at once. +const CHECKING: usize = 2; const SOURCES: [(SourceId, &str); 2] = [ (SourceId::Modrinth, "Modrinth"), (SourceId::CurseForge, "CurseForge"), @@ -26,6 +32,15 @@ pub(super) enum Event { Progress(String, f32), Done(Result, bool), Updates(HashMap<(SourceId, String), String>), + /// A Java mod's check: its jar read, or why it couldn't be. + Checked((SourceId, String), Result, String>), +} + +/// Where a Java mod's check is. +pub(super) enum Checking { + Running, + Done(Box), + Failed(String), } pub(super) struct Mods { @@ -50,6 +65,8 @@ pub(super) struct Mods { message: Option>, updates: HashMap<(SourceId, String), String>, confirm_remove: Option, + /// Java mods' checks, by source and project. + checks: HashMap<(SourceId, String), Checking>, tx: Sender, rx: Receiver, } @@ -58,7 +75,7 @@ impl Mods { pub(super) fn new(cx: &mut App) -> Self { let (tx, rx) = channel(); Self { - kind: PackKind::ResourcePack, + kind: PackKind::Mod, source: SourceId::Modrinth, curseforge: CurseForge::from_env().is_some(), text: String::new(), @@ -77,6 +94,7 @@ impl Mods { message: None, updates: HashMap::new(), confirm_remove: None, + checks: HashMap::new(), tx, rx, } @@ -91,6 +109,19 @@ impl Mods { .iter() .find(|e| e.source == p.source && e.project == p.id) } + + /// How well a result runs: a Java mod's from its check once it has one. + fn support(&self, p: &Project) -> Support { + let metadata = p.support(); + if p.kind != PackKind::Mod || !metadata.installable() { + return metadata; + } + match self.checks.get(&(p.source, p.id.clone())) { + Some(Checking::Done(c)) => java::support_of(c), + Some(Checking::Failed(e)) => Support::Partial(format!("Not checked: {e}")), + _ => Support::Partial("Checking its jar…".into()), + } + } } /// `51404735` → `51.4M`. @@ -115,6 +146,7 @@ impl Launcher { /// Called with the launcher's other work: what the background sent. pub(super) fn mods_tick(&mut self) -> bool { let mut changed = false; + let mut to_check = Vec::new(); while let Ok(event) = self.mods.rx.try_recv() { changed = true; let m = &mut self.mods; @@ -126,8 +158,9 @@ impl Launcher { Ok(found) => { m.more = found.len() == PAGE; m.results.truncate(offset); - m.results.extend(found); + m.results.extend(found.iter().cloned()); m.error = None; + to_check.extend(found); } Err(e) => m.error = Some(e), } @@ -149,8 +182,16 @@ impl Launcher { } } Event::Updates(found) => m.updates = found, + Event::Checked(key, result) => { + let state = match result { + Ok(c) => Checking::Done(c), + Err(e) => Checking::Failed(e), + }; + m.checks.insert(key, state); + } } } + self.mods_check(to_check); changed } @@ -177,6 +218,43 @@ impl Launcher { }); } + /// Checks the Java mods among `found` that aren't checked yet, a few at a time, on threads: + /// a cached check answers at once, else the jar is downloaded and read. + fn mods_check(&mut self, found: Vec) { + let m = &mut self.mods; + let todo: Vec = found + .into_iter() + .filter(|p| p.kind == PackKind::Mod && p.support().installable()) + .filter(|p| !m.checks.contains_key(&(p.source, p.id.clone()))) + .collect(); + if todo.is_empty() { + return; + } + for p in &todo { + m.checks.insert((p.source, p.id.clone()), Checking::Running); + } + let (tx, everything) = (m.tx.clone(), m.everything); + let queue = std::sync::Mutex::new(todo.into_iter()); + std::thread::spawn(move || { + let home = backend::game_home(); + std::thread::scope(|s| { + for _ in 0..CHECKING { + s.spawn(|| { + while let Some(p) = queue.lock().ok().and_then(|mut q| q.next()) { + let result = browser::source(p.source) + .ok_or_else(|| format!("{} isn't set up.", p.source.label())) + .and_then(|source| { + java::check_project(&home, &*source, &p, everything, &|_| {}) + }) + .map(|(_, c)| Box::new(c)); + let _ = tx.send(Event::Checked((p.source, p.id), result)); + } + }); + } + }); + }); + } + /// Looks for newer versions of what the browser installed. fn mods_check_updates(&mut self) { let entries = self.mods.installed.clone(); @@ -233,7 +311,7 @@ impl Launcher { let log = |line: String| progress(&line, 1.); let pack = modpacks::import(&file, &log)?; return Ok(format!( - "{} is imported: open it on the Modpacks page to port it.", + "{} is imported: it is listed above, ready to port.", pack.title() )); } @@ -243,6 +321,19 @@ impl Launcher { .iter() .map(|e| format!("{} {}", e.title, e.number)) .collect(); + if p.kind == PackKind::Mod { + let skipped = done.last().map_or(0, |e| e.skipped.len()); + return Ok(format!( + "Ported {} into horizon-mods and turned on (Options > Mods in the \ + game).{}", + names.join(", "), + if skipped > 0 { + " What didn't port is listed under Installed." + } else { + "" + } + )); + } let turn_on = match p.kind { PackKind::ShaderPack => "Video Settings > Shader Packs", _ => "Options > Resource Packs", @@ -330,8 +421,10 @@ impl Launcher { } let header = page_header( "Mods", - "Resource packs, shader packs and modpacks that Horizon loads. Each file is checked \ - against its source's checksum before it reaches your game folder.", + "Java mods, modpacks, resource packs and shader packs. Horizon ports what a Java mod \ + carries (blocks, items, recipes, worldgen) and says before you install what runs. \ + Each file is checked against its source's checksum before it reaches your game \ + folder.", &t, ); let this = cx.entity().downgrade(); @@ -436,6 +529,9 @@ impl Launcher { Some(Err(e)) => page = page.child(notice(e.clone(), &t)), None => {} } + if self.mods.kind == PackKind::Modpack { + page = page.child(self.imported_packs(cx)); + } if let Some(list) = self.mods_installed_list(cx) { page = page.child(list); } @@ -512,7 +608,11 @@ impl Launcher { .flex() .flex_col() .child(format!( - "{} · from {}{} · {}", + "{}{} · from {}{} · {}", + e.verdict + .as_ref() + .map(|v| format!("{v} · ")) + .unwrap_or_default(), e.number, e.source.label(), if e.dependency { @@ -522,6 +622,11 @@ impl Launcher { }, e.file )) + .children(e.skipped.iter().map(|s| { + div() + .text_color(t.ink_soft) + .child(format!("Not ported: {s}")) + })) .child( div() .font_family(theme::MONO) @@ -564,7 +669,13 @@ impl Launcher { let busy = m.busy.as_ref().map(|b| b.0.as_str()); let mut list = div().flex().flex_col().border_t_1().border_color(t.rule); for (i, p) in m.results.iter().enumerate() { - let support = p.support(); + let support = m.support(p); + let checking = p.kind == PackKind::Mod + && matches!( + m.checks.get(&(p.source, p.id.clone())), + None | Some(Checking::Running) + ) + && p.support().installable(); let color = match support { Support::Works => t.success, Support::Partial(_) => t.accent, @@ -591,6 +702,8 @@ impl Launcher { right = right.child(caps("Installing").text_color(t.accent)); } else if m.entry(p).is_some() { right = right.child(caps("Installed").text_color(t.muted)); + } else if checking { + right = right.child(caps("Checking").text_color(t.muted)); } else if support.installable() { let label = if p.kind == PackKind::Modpack { "Import" diff --git a/website/docs/modpacks.md b/website/docs/modpacks.md index a4396392b..b78c59851 100644 --- a/website/docs/modpacks.md +++ b/website/docs/modpacks.md @@ -6,7 +6,7 @@ Java mod jars do not run in Horizon. Instead, the launcher reads a modpack, tell ## What the Modpacks page does -Open **Modpacks** in the launcher. +Open **Modpacks** in the launcher. (From the next launcher release, it is the **Modpacks** tab of the **Mods** page.) 1. **Import a pack.** Choose **Import a pack file…** for a Modrinth `.mrpack` or a CurseForge zip, or **Import an instance folder…** for a Prism, MultiMC or CurseForge instance. The **Mods** page can also find a Modrinth modpack and import it for you (see [Mods and data packs](/docs/mods#finding-resource-packs-shader-packs-and-modpacks)). 2. **Read the coverage report.** For every mod in the pack it says **Ported**, **Partial**, **Not yet** or **Not needed**, with the reason. You can filter the list by status. diff --git a/website/docs/mods.md b/website/docs/mods.md index 05dcaee2d..d3305fa69 100644 --- a/website/docs/mods.md +++ b/website/docs/mods.md @@ -36,7 +36,17 @@ cargo horizon-mod run The launcher's **Mods** page (launcher 0.17 and newer) searches [Modrinth](https://modrinth.com) for what Horizon can load: resource packs, Java shader packs and modpacks. Each result says how well it runs in Horizon (**Works**, **Partly**, or **Doesn't run**), and by default the page shows only what runs. **Install** downloads the file, checks it against the checksum Modrinth lists and refuses anything that does not match, then puts it in the right folder, with the packs it needs. **Update** and **Remove** are there too. A resource pack still has to be turned on in the game's Resource Packs screen, and a shader pack in Video, Shader Packs. A modpack is imported on the [Modpacks page](/docs/modpacks). -The page cannot search CurseForge yet. Java mod jars are never offered, because they do not run. The same things work from a terminal: `horizon-launcher mods search`, `install`, `update` and `remove`. +The page cannot search CurseForge yet. The same things work from a terminal: `horizon-launcher mods search`, `install`, `update` and `remove`. + +## Java mods from the Mods page (next launcher release) + +Java code does not run in Horizon, but much of what a mod adds is data: blocks, items, recipes, loot tables, tags, worldgen, textures. From the next launcher release, the Mods page also lists Fabric, NeoForge and Forge mods made for 26.3 and, before offering one, downloads its jar, checks it against Modrinth's checksum and reads it (without running it) to say what of it Horizon runs: + +- **Works**: the mod is only content, and all of it carries over. +- **Partly**: its content carries over; the row lists what does not, such as machines and containers, mobs, blocks or items with behaviour of their own, recipe types of its own, or Mixins. +- **Doesn't run**: there is nothing to carry over (performance mods, libraries, mods that are all code). It is not offered. + +**Install** brings the mod over into `horizon-mods` and turns it on; start the game again to load it. Blocks take the closest vanilla block's shape, hardness and sounds, so a carried-over block can break faster or slower than in Java. Most popular mods today are **Partly** or **Doesn't run**: the verdict is the honest answer for each one. ## Data packs From a3f81f3a30ec54d2cb84e806334db2db8a14684b Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Thu, 22 Oct 2026 18:10:20 +0200 Subject: [PATCH 2/3] Launcher: test a Java mod's install, dependencies, id clash and removal offline Co-Authored-By: Claude Opus 5.5 --- launcher/src/browser/installed/tests.rs | 82 +++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/launcher/src/browser/installed/tests.rs b/launcher/src/browser/installed/tests.rs index af55ec78d..e3fe7899c 100644 --- a/launcher/src/browser/installed/tests.rs +++ b/launcher/src/browser/installed/tests.rs @@ -250,3 +250,85 @@ fn shader_packs_go_to_their_folder_and_modpacks_download_checked() { assert!(!downloads.join("atm-2.zip").exists()); fs::remove_dir_all(&home).unwrap(); } + +/// A NeoForge jar with `files` beside its `neoforge.mods.toml` for mod `id`. +fn mod_jar(id: &str, files: &[(&str, &str)]) -> Vec { + use std::io::Write; + let mut zip = zip::ZipWriter::new(std::io::Cursor::new(Vec::new())); + let toml = format!( + "modLoader = \"javafml\"\nlicense = \"MIT\"\n[[mods]]\nmodId = \"{id}\"\nversion = \"1.0\"\ndisplayName = \"{id}\"\n" + ); + for (name, text) in [("META-INF/neoforge.mods.toml", toml.as_str())] + .into_iter() + .chain(files.iter().copied()) + { + zip.start_file(name, zip::write::SimpleFileOptions::default()) + .unwrap(); + zip.write_all(text.as_bytes()).unwrap(); + } + zip.finish().unwrap().into_inner() +} + +#[test] +fn java_mods_are_ported_turned_on_refused_on_clashes_and_removed() { + let home = home("java"); + let mut fake = Fake::default(); + for id in ["ruby", "lib", "gem"] { + let mut p = project(id, Kind::Mod); + p.loaders = vec!["neoforge".into()]; + fake.add(p); + } + let block = r#"{"variants": {"": {"model": "ruby:block/ruby_block"}}}"#; + let recipe = r#"{"type": "minecraft:crafting_shapeless", "ingredients": ["minecraft:red_dye"], "result": {"id": "ruby:ruby_block"}}"#; + let ruby = mod_jar( + "ruby", + &[ + ("assets/ruby/blockstates/ruby_block.json", block), + ("data/ruby/recipe/ruby_block.json", recipe), + ], + ); + // A library: nothing to port. + let lib = mod_jar("lib", &[]); + // Another project with the same mod id. + let gem = mod_jar("ruby", &[("assets/ruby/blockstates/gem.json", block)]); + fake.release("ruby", "1", &["lib"], &ruby, false); + fake.release("lib", "1", &[], &lib, false); + fake.release("gem", "1", &[], &gem, false); + + let done = install(&fake, &fake.project("ruby").unwrap(), false, &home, NONE).unwrap(); + assert_eq!(done.len(), 1, "the library isn't installed"); + let entry = &done[0]; + assert_eq!(entry.file, "horizon-mods/ruby"); + assert_eq!(entry.verdict.as_deref(), Some("Works")); + assert!( + entry + .skipped + .iter() + .any(|s| s.starts_with("needs Pack lib")), + "{:?}", + entry.skipped + ); + assert!(entry.namespaces.contains(&"ruby".to_owned())); + assert!(home.join("horizon-mods/ruby/horizon-mod.toml").is_file()); + assert_eq!( + fs::read_to_string(home.join("horizon-mods.txt")).unwrap(), + "mod.ruby:true\n" + ); + // The jar isn't kept, its check is. + assert!(!home + .join("mod-browser/checks-1/.downloads/ruby-1.zip") + .exists()); + + let clash = install(&fake, &fake.project("gem").unwrap(), false, &home, NONE).unwrap_err(); + assert!(clash.contains("shares its id or namespace"), "{clash}"); + assert!(!home.join("horizon-mods/gem").exists()); + + let removed = remove(&home, "ruby").unwrap(); + assert_eq!(removed.kind, Kind::Mod); + assert!(!home.join("horizon-mods/ruby").exists()); + assert_eq!( + fs::read_to_string(home.join("horizon-mods.txt")).unwrap(), + "" + ); + fs::remove_dir_all(&home).unwrap(); +} From b8f79247b865c2a4bba9d5e65803e280f581ceca Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Thu, 22 Oct 2026 18:50:25 +0200 Subject: [PATCH 3/3] Mod browser: CurseForge is coming soon Ludovic dropped CurseForge for now (its API needs a paid key). The Mods page shows "CurseForge (coming soon)" beside the Modrinth switch, disabled and inert; browser::sources() is Modrinth only, so no search or install goes to CurseForge, and `--source curseforge` says it is coming soon. Text that asked for a key or an environment variable now says CurseForge support is coming soon. Importing a CurseForge zip or instance still works; jars only CurseForge serves are listed as "CurseForge downloads coming soon". Co-Authored-By: Claude Opus 5.5 --- docs/mod-browser.md | 30 ++++++++++----------------- launcher/README.md | 10 ++++----- launcher/src/browser.rs | 14 ++++++------- launcher/src/browser/tests.rs | 7 +++++++ launcher/src/cli.rs | 10 ++++----- launcher/src/modpacks.rs | 3 ++- launcher/src/mods_page.rs | 38 +++++++++++++++++------------------ website/docs/modpacks.md | 2 +- website/docs/mods.md | 2 +- 9 files changed, 58 insertions(+), 58 deletions(-) diff --git a/docs/mod-browser.md b/docs/mod-browser.md index bc7a80b16..6601fea70 100644 --- a/docs/mod-browser.md +++ b/docs/mod-browser.md @@ -1,6 +1,6 @@ # The launcher's mod browser -Search Modrinth (and CurseForge, once the launcher has a key) for Java mods, modpacks, resource packs and shader +Search Modrinth (CurseForge support is coming soon) for Java mods, modpacks, resource packs and shader packs, see how well each one runs before installing it, and install it with its checksum checked. This is item 16 of the roadmap and issue #577. The code is in `launcher/src/browser.rs` and `launcher/src/browser/`. @@ -63,8 +63,8 @@ off. ## The Mods page -The launcher's **Mods** page has the four kinds as tabs (Mods, Modpacks, Resource packs, Shader packs), a search field (Enter searches), **Show everything** and, -once CurseForge is set up, a Modrinth / CurseForge switch. Each result is an index row: its summary, author, +The launcher's **Mods** page has the four kinds as tabs (Mods, Modpacks, Resource packs, Shader packs), a search field (Enter searches), **Show everything** and +the source: Modrinth, with **CurseForge (coming soon)** beside it, disabled. Each result is an index row: its summary, author, downloads, source and licence, how well it runs (and why), **Page** (the project's page on its source) and **Install** (**Import** for a modpack). The Modpacks tab lists the imported packs first, with their coverage report, **Port** and **Play** ([modpacks.md](modpacks.md)). Installed packs are listed above the results with their version, source, @@ -102,21 +102,13 @@ horizon-launcher mods remove faithful-32x **Modrinth.** The public API (`api.modrinth.com/v2`) needs no key. The launcher names itself in its user agent, as Modrinth asks. -### CurseForge +### CurseForge (coming soon) -CurseForge's API (`api.curseforge.com/v1`) needs an API key from its developer console. Ludovic approved CurseForge -for the browser on 2026-10-21; the key is his (agents never sign up for him). Until a key exists the CurseForge source -is off and the browser searches Modrinth only. +CurseForge support is coming soon. Its API (`api.curseforge.com/v1`) needs a paid key, so for now the launcher +doesn't use it: the Mods page shows **CurseForge (coming soon)** beside the Modrinth switch, disabled, and no search +or install goes to CurseForge (`browser::sources()` is Modrinth only; `horizon-launcher mods ... --source curseforge` +says it is coming soon). The CurseForge source (`browser/curseforge.rs`) is kept for when it comes. -To turn it on: - -1. Ludovic gets a key at (sign in, API keys). CurseForge's terms for a launcher - that ships the key apply: the key is built into the binary, so anyone with the binary can read it. -2. He stores it in the 1Password **Agents** vault as an item `CurseForge API`, field `credential`. -3. It goes into the repository secret `HORIZON_CURSEFORGE_API_KEY` - (`~/fleet/op read "op://Agents/CurseForge API/credential" | gh secret set HORIZON_CURSEFORGE_API_KEY`). - The launcher workflow passes it to the build, which builds it in (`option_env!`). - -At run time `HORIZON_CURSEFORGE_API_KEY` in the environment overrides the built-in key; empty means none. A file -whose author allows downloads from CurseForge's own site only (no `downloadUrl` in the API) is shown but can't be -installed. +A CurseForge modpack zip or instance the player already has still imports, since that needs no key: its jars come +from the player's installed instance or, when Modrinth has the same file, from Modrinth. A jar only CurseForge serves +is listed under the pack as "CurseForge downloads coming soon". diff --git a/launcher/README.md b/launcher/README.md index 08ec11f98..85b74e6aa 100644 --- a/launcher/README.md +++ b/launcher/README.md @@ -24,10 +24,10 @@ The opening, then Play ([clip](docs/opening.webm)): preparation reuses checksum-verified game jars and libraries from the current or another installed Horizon version, so the original Minecraft install is only required when no valid imported copy exists. -- **Mods**: search Modrinth (and CurseForge once the launcher has its API key) for resource +- **Mods**: search Modrinth (CurseForge support is coming soon) for resource packs, Iris/OptiFine shader packs and modpacks, each marked Works, Partly or Doesn't run in Horizon; Java mod jars are never offered. Install puts a pack and what it needs in - `resourcepacks/` or `shaderpacks/` only after its SHA-512 (SHA-1 on CurseForge) matches, and a + `resourcepacks/` or `shaderpacks/` only after its SHA-512 matches, and a modpack goes to the Modpacks page; installed packs show their source and checksum, with Update and Remove ([docs/mod-browser.md](../docs/mod-browser.md)). - **Modpacks**: import a Java modpack (a Modrinth `.mrpack`, a CurseForge zip, or a Prism, @@ -35,8 +35,8 @@ The opening, then Play ([clip](docs/opening.webm)): not yet or not needed, with the reason ([docs/modpacks.md](../docs/modpacks.md)). **Port** gets the jars of what this computer can port today (content mods with data and assets only) the player's own way: copied from a folder they have, or downloaded from the pack's own links - or the same file on Modrinth's CDN, hash checked; files only CurseForge has need its API key, so - they come from your installed instance. It carries them over for the selected version, and + or the same file on Modrinth's CDN, hash checked; files only CurseForge has come from your + installed instance (CurseForge downloads are coming soon). It carries them over for the selected version, and **Play** starts the game as the pack's own profile (`ports//home/` in the game's home: its own saves and options) with those mods. Nothing is uploaded or shared: mod jars and ports stay on this computer. @@ -155,7 +155,7 @@ The same binary is a command-line tool; without a subcommand it opens the window horizon-launcher modpack play [--version ] play it as its own profile horizon-launcher modpack remove horizon-launcher mods [list] what the mod browser installed (docs/mod-browser.md) - horizon-launcher mods search [--kind resource|shader|modpack] [--everything] [--source modrinth|curseforge] + horizon-launcher mods search [--kind resource|shader|modpack] [--everything] [--source modrinth] horizon-launcher mods install checksum checked, with what it needs; a modpack is imported horizon-launcher mods update [] [--check] horizon-launcher mods remove diff --git a/launcher/src/browser.rs b/launcher/src/browser.rs index b8248fd7c..c4a6ff726 100644 --- a/launcher/src/browser.rs +++ b/launcher/src/browser.rs @@ -1,4 +1,4 @@ -//! The mod browser's sources: search Modrinth (and CurseForge, once a key exists) for what +//! The mod browser's sources: search Modrinth (CurseForge support is coming soon) for what //! Horizon loads, say how well each result runs, and download a file only after its checksum //! matches (docs/mod-browser.md). //! @@ -221,13 +221,13 @@ pub trait Source: Send + Sync { } } -/// The sources this launcher can use: Modrinth always, CurseForge when it has an API key. +/// What the launcher says wherever CurseForge would be. +pub const CURSEFORGE_SOON: &str = "CurseForge support is coming soon."; + +/// The sources this launcher uses: Modrinth. CurseForge support is coming soon: its API needs a +/// paid key, so no search or install goes to it; `curseforge` is kept for then. pub fn sources() -> Vec> { - let mut all: Vec> = vec![Box::new(modrinth::Modrinth)]; - if let Some(cf) = curseforge::CurseForge::from_env() { - all.push(Box::new(cf)); - } - all + vec![Box::new(modrinth::Modrinth)] } /// The source of that id, when this launcher can use it. diff --git a/launcher/src/browser/tests.rs b/launcher/src/browser/tests.rs index 9e75c55a1..2137ecc94 100644 --- a/launcher/src/browser/tests.rs +++ b/launcher/src/browser/tests.rs @@ -400,3 +400,10 @@ fn live_modrinth_search_pick_and_download() { std::fs::remove_dir_all(&dir).unwrap(); assert_eq!(source.project(&p.id).unwrap().slug, p.slug); } + +#[test] +fn curseforge_is_coming_soon_and_never_searched() { + let ids: Vec = sources().iter().map(|s| s.id()).collect(); + assert_eq!(ids, [SourceId::Modrinth]); + assert!(source(SourceId::CurseForge).is_none()); +} diff --git a/launcher/src/cli.rs b/launcher/src/cli.rs index 530d220dd..ebcc95cd6 100644 --- a/launcher/src/cli.rs +++ b/launcher/src/cli.rs @@ -212,6 +212,7 @@ enum KindArg { #[derive(Clone, Copy, clap::ValueEnum)] enum SourceArg { Modrinth, + /// CurseForge support is coming soon Curseforge, } @@ -222,9 +223,7 @@ impl SourceArg { SourceArg::Modrinth => SourceId::Modrinth, SourceArg::Curseforge => SourceId::CurseForge, }; - browser::source(id).ok_or_else(|| { - "CurseForge needs an API key: HORIZON_CURSEFORGE_API_KEY (docs/mod-browser.md).".into() - }) + browser::source(id).ok_or_else(|| browser::CURSEFORGE_SOON.into()) } } @@ -337,8 +336,9 @@ enum Cmd { #[command(subcommand)] action: Option, }, - /// The mod browser: resource packs, shader packs and modpacks from Modrinth (and CurseForge - /// with a key), each file checked against its checksum (docs/mod-browser.md) + /// The mod browser: Java mods, resource packs, shader packs and modpacks from Modrinth + /// (CurseForge support is coming soon), each file checked against its checksum + /// (docs/mod-browser.md) Mods { #[command(subcommand)] action: Option, diff --git a/launcher/src/modpacks.rs b/launcher/src/modpacks.rs index b69ff0976..2495e1ad6 100644 --- a/launcher/src/modpacks.rs +++ b/launcher/src/modpacks.rs @@ -84,7 +84,8 @@ impl Imported { (How::Present, "already here"), ( How::NeedsKey, - "only on CurseForge (needs its API key: choose your installed instance instead)", + "only on CurseForge (CurseForge downloads coming soon: choose your installed \ + instance instead)", ), (How::NotFound, "not found"), (How::Failed, "failed"), diff --git a/launcher/src/mods_page.rs b/launcher/src/mods_page.rs index 136ca7953..fd6a24b76 100644 --- a/launcher/src/mods_page.rs +++ b/launcher/src/mods_page.rs @@ -1,12 +1,11 @@ -//! The Mods page: search Modrinth (and CurseForge with a key) for Java mods, modpacks, resource +//! The Mods page: search Modrinth (CurseForge: coming soon) for Java mods, modpacks, resource //! packs and shader packs, see where each comes from and how well it runs (a Java mod's jar is //! checked first), install it with its checksum checked, and update or remove what was installed //! (`horizon_launcher::browser`). Imported modpacks are listed on its Modpacks tab. use super::servers_page::{type_key, Key}; use super::*; use horizon_launcher::browser::{ - self, curseforge::CurseForge, installed, java, Kind as PackKind, Project, Query, SourceId, - Support, + self, installed, java, Kind as PackKind, Project, Query, SourceId, Support, }; use horizon_launcher::modpacks; use horizon_port_pack::check::Check; @@ -20,10 +19,8 @@ const KINDS: [(PackKind, &str); 4] = [ ]; /// Java mods checked at once. const CHECKING: usize = 2; -const SOURCES: [(SourceId, &str); 2] = [ - (SourceId::Modrinth, "Modrinth"), - (SourceId::CurseForge, "CurseForge"), -]; +/// The sources to pick from; CurseForge is shown beside them as coming soon. +const SOURCES: [(SourceId, &str); 1] = [(SourceId::Modrinth, "Modrinth")]; const PAGE: usize = 20; pub(super) enum Event { @@ -46,7 +43,6 @@ pub(super) enum Checking { pub(super) struct Mods { kind: PackKind, source: SourceId, - curseforge: bool, text: String, focus: FocusHandle, pub(super) focused: bool, @@ -77,7 +73,6 @@ impl Mods { Self { kind: PackKind::Mod, source: SourceId::Modrinth, - curseforge: CurseForge::from_env().is_some(), text: String::new(), focus: cx.focus_handle().tab_index(0).tab_stop(true), focused: false, @@ -458,8 +453,14 @@ impl Launcher { this.mods_search(0); cx.notify(); })); - let source_note = if self.mods.curseforge { - segments("mods-source", &SOURCES, self.mods.source, &t, { + // CurseForge support is coming soon: shown, inert, never searched (like the Microsoft + // account's "Coming soon"). + let source_note = div() + .flex() + .flex_wrap() + .items_center() + .gap(px(8.)) + .child(segments("mods-source", &SOURCES, self.mods.source, &t, { let this = this.clone(); move |source, _, cx| { let _ = this.update(cx, |this, cx| { @@ -470,14 +471,13 @@ impl Launcher { cx.notify(); }); } - }) - .into_any_element() - } else { - text(theme::CAPTION) - .text_color(t.muted) - .child("From Modrinth. CurseForge comes once the launcher has its API key.") - .into_any_element() - }; + })) + .child(disabled(button( + "mods-source-curseforge", + "CurseForge (coming soon)", + Kind::Ghost, + &t, + ))); let controls = div() .flex() .flex_col() diff --git a/website/docs/modpacks.md b/website/docs/modpacks.md index b78c59851..e3ed053d9 100644 --- a/website/docs/modpacks.md +++ b/website/docs/modpacks.md @@ -10,7 +10,7 @@ Open **Modpacks** in the launcher. (From the next launcher release, it is the ** 1. **Import a pack.** Choose **Import a pack file…** for a Modrinth `.mrpack` or a CurseForge zip, or **Import an instance folder…** for a Prism, MultiMC or CurseForge instance. The **Mods** page can also find a Modrinth modpack and import it for you (see [Mods and data packs](/docs/mods#finding-resource-packs-shader-packs-and-modpacks)). 2. **Read the coverage report.** For every mod in the pack it says **Ported**, **Partial**, **Not yet** or **Not needed**, with the reason. You can filter the list by status. -3. **Port.** **Port N mods** gets the jars of the mods this computer can carry over today, and carries them over for the version you picked. It copies the jars from a folder you have, or downloads them from the pack's own links (or the same file from Modrinth's download network), and checks their hashes. Files that only CurseForge has need CurseForge's API key, so for those choose **Use jars from my instance…** and point it at your installed instance. +3. **Port.** **Port N mods** gets the jars of the mods this computer can carry over today, and carries them over for the version you picked. It copies the jars from a folder you have, or downloads them from the pack's own links (or the same file from Modrinth's download network), and checks their hashes. CurseForge downloads are coming soon, so for files that only CurseForge has, choose **Use jars from my instance…** and point it at your installed instance. 4. **Play.** **Play with N mods** starts the game as the pack's own profile, with its own saves and options, and those mods on. Nothing is uploaded or shared. The mod jars and what is made from them stay on your computer. diff --git a/website/docs/mods.md b/website/docs/mods.md index d3305fa69..b0bd8c31f 100644 --- a/website/docs/mods.md +++ b/website/docs/mods.md @@ -36,7 +36,7 @@ cargo horizon-mod run The launcher's **Mods** page (launcher 0.17 and newer) searches [Modrinth](https://modrinth.com) for what Horizon can load: resource packs, Java shader packs and modpacks. Each result says how well it runs in Horizon (**Works**, **Partly**, or **Doesn't run**), and by default the page shows only what runs. **Install** downloads the file, checks it against the checksum Modrinth lists and refuses anything that does not match, then puts it in the right folder, with the packs it needs. **Update** and **Remove** are there too. A resource pack still has to be turned on in the game's Resource Packs screen, and a shader pack in Video, Shader Packs. A modpack is imported on the [Modpacks page](/docs/modpacks). -The page cannot search CurseForge yet. The same things work from a terminal: `horizon-launcher mods search`, `install`, `update` and `remove`. +CurseForge support is coming soon: the page shows it, but doesn't search it yet. The same things work from a terminal: `horizon-launcher mods search`, `install`, `update` and `remove`. ## Java mods from the Mods page (next launcher release)