[PR #3325] [MERGED] Create World: the Data Packs screen #4902

Closed
opened 2026-11-03 05:08:46 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3325
Author: @ThatCakeIsAPie
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @ludovic111

Base: main ← Head: feat/create-world-data-packs


📝 Commits (2)

  • 24e3168 Create World: the Data Packs screen
  • 1d01a2d Merge remote-tracking branch 'origin/main' into upd/3325

📊 Changes

13 files changed (+367 additions, -24 deletions)

View changed files

📝 crates/horizon-client-render/src/datapack.rs (+155 -0)
📝 crates/horizon-client-render/src/options_ui.rs (+72 -4)
📝 crates/horizon-client-render/src/pack_screen.rs (+9 -4)
📝 crates/horizon-client-render/src/packs.rs (+21 -6)
📝 crates/horizon-client/examples/probe/pack_screen_fixture.rs (+1 -0)
📝 crates/horizon-client/src/game.rs (+16 -0)
📝 crates/horizon-client/src/game/options.rs (+9 -0)
📝 crates/horizon-client/src/game/startup_menu.rs (+14 -0)
📝 crates/horizon-client/src/title.rs (+34 -1)
📝 crates/horizon-client/src/title/create_world.rs (+9 -2)
📝 crates/horizon-client/src/title/tests.rs (+20 -3)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPackScreenOracle.java (+1 -1)
📝 tools/test_pack_screen_parity.py (+6 -3)

📄 Description

🤖 Opened by ThatCakeIsAPie's AI agent (Claude), not by ThatCakeIsAPie themself.

What and why

Create World's Data Packs button (More tab) has been disabled ("Experiments and data packs have no screens yet"). This turns it on: it opens vanilla's data pack screen, so a new world can start with data packs chosen in game rather than copied into datapacks/ afterwards.

  • The screen is the existing PackSelectionScreen port (pack_screen.rs) under the title dataPack.title. It opens over a new mcworld- temporary folder, as CreateWorldScreen.getDataPackSelectionSettings makes one. It lists that folder's packs with their icons (PackSource.WORLD, compatibility against the data pack format) and the built-in pack. The built-in pack has its pack.png, isn't required and sits at the bottom, as ServerPacksSource.VANILLA_SELECTION_CONFIG has it.
  • Open Pack Folder opens that folder. The lists are refreshed within a second when packs are added or removed, as PackSelectionScreen's watcher does; the selection is kept.
  • Done keeps the selection for the world (applyNewPackConfig). Create New World copies the folder's packs into <world>/datapacks and writes datapacks.json with the selection enabled and the rest disabled (copyTempDataPackDirToNewWorld). That is the file /datapack and the launcher's data pack page already use. Cancel deletes the folder (removeTempDataPackDir).
  • Worlds created without opening the screen are unchanged: no datapacks/ folder, no datapacks.json.

How it plugs in: the More tab's button returns title::Action::DataPacks. The game opens the options UI's existing Packs page in a data-pack mode (OptionsUi::open_data_packs), so the search box, scrolling, the incompatible-pack confirm and key handling come with it, from both the startup menu and the title. PackScreen::new now takes its title.

Not included:

  • Experiment (feature) packs aren't offered, since Horizon has no experiments (the Experiments button stays off).
  • Files dropped on the window aren't added (onFilesDrop); the resource pack screen doesn't take them yet either.
  • Old-format packs are listed as incompatible and can be selected after vanilla's confirm, but nothing upgrades them. A 26.2 → 26.3 data pack upgrader is coming in separate PRs.
  • level.dat's DataPacks isn't written; the game reads datapacks.json.

Vanilla reference

  • CreateWorldScreen: openDataPackSelectionScreen, getDataPackSelectionSettings (mcworld- temp folder, ServerPacksSource.createPackRepository), copyTempDataPackDirToNewWorld, removeTempDataPackDir, applyNewPackConfig.
  • PackSelectionScreen, with its watcher's reload.
  • ServerPacksSource: VANILLA_PACK_INFO (dataPack.vanilla.name/description), VANILLA_SELECTION_CONFIG (not required, bottom, not fixed), FolderRepositorySource with PackSource.WORLD.
  • Harness: tools/test_pack_screen_parity.py now runs every fourth case under dataPack.title (the oracle and pack_screen_fixture take the title from the case). On this branch: 3000/3000 pack screens match, 750 of them under dataPack.title.
  • In game (fast build, offscreen, driven by horizon-ctl): Singleplayer → Create World → More → Data Packs, a one-function test pack copied into the folder, selected, Done, Create New World.
    • datapacks.json is {"enabled":["vanilla","file/Hello Pack"],"disabled":[]}.
    • /function demo:hello runs the pack's function.
    • The mcworld- folder is gone afterwards.
    • Unit tests: datapack::tests::create_world_installs_its_packs and the More-tab flow in title::tests.

Self-check

Run on Windows. The failures are the ones main has on Windows: two Rust tests (crash stack paths, session_lock_is_exclusive), and two Python tests (a symlink needing a Windows privilege, a ~/code/... path). The parity harness above was run separately.

pr_ready (tools/pr_ready.py --quick --base upstream/main on DESKTOP-LT6RAH8, against upstream/main at 07e4a8665, 27 min 0 s)

Check Result
Scope ✅ 13 files, +367 −24
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 401 run, FAILED (failures=1, errors=1, skipped=1) (3 min 44 s)
rustfmt ✅ (15 s)
clippy ✅ (4 min 48 s)
tests: horizon-client ❌ 1095 passed, 2 failed (16 min 4 s)
doc tests ✅ 0 passed (1 min 45 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Suggested label: feature.

Screenshots

Before: the More tab's Data Packs button was disabled. After, the screen with a pack in its folder, then with it selected:

Data Packs screen, pack available

Data Packs screen, pack selected

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/3325 **Author:** [@ThatCakeIsAPie](https://github.com/ThatCakeIsAPie) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/create-world-data-packs` --- ### 📝 Commits (2) - [`24e3168`](https://github.com/horizon-rust/horizon/commit/24e316855ebda90aff14272065c8a04f5aff7766) Create World: the Data Packs screen - [`1d01a2d`](https://github.com/horizon-rust/horizon/commit/1d01a2d69671d8c32327120534a0de5140608dc4) Merge remote-tracking branch 'origin/main' into upd/3325 ### 📊 Changes **13 files changed** (+367 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/datapack.rs` (+155 -0) 📝 `crates/horizon-client-render/src/options_ui.rs` (+72 -4) 📝 `crates/horizon-client-render/src/pack_screen.rs` (+9 -4) 📝 `crates/horizon-client-render/src/packs.rs` (+21 -6) 📝 `crates/horizon-client/examples/probe/pack_screen_fixture.rs` (+1 -0) 📝 `crates/horizon-client/src/game.rs` (+16 -0) 📝 `crates/horizon-client/src/game/options.rs` (+9 -0) 📝 `crates/horizon-client/src/game/startup_menu.rs` (+14 -0) 📝 `crates/horizon-client/src/title.rs` (+34 -1) 📝 `crates/horizon-client/src/title/create_world.rs` (+9 -2) 📝 `crates/horizon-client/src/title/tests.rs` (+20 -3) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPackScreenOracle.java` (+1 -1) 📝 `tools/test_pack_screen_parity.py` (+6 -3) </details> ### 📄 Description > 🤖 Opened by ThatCakeIsAPie's AI agent (Claude), not by ThatCakeIsAPie themself. ## What and why Create World's **Data Packs** button (More tab) has been disabled ("Experiments and data packs have no screens yet"). This turns it on: it opens vanilla's data pack screen, so a new world can start with data packs chosen in game rather than copied into `datapacks/` afterwards. - **The screen** is the existing `PackSelectionScreen` port (`pack_screen.rs`) under the title `dataPack.title`. It opens over a new `mcworld-` temporary folder, as `CreateWorldScreen.getDataPackSelectionSettings` makes one. It lists that folder's packs with their icons (`PackSource.WORLD`, compatibility against the data pack format) and the built-in pack. The built-in pack has its `pack.png`, isn't required and sits at the bottom, as `ServerPacksSource.VANILLA_SELECTION_CONFIG` has it. - **Open Pack Folder** opens that folder. The lists are refreshed within a second when packs are added or removed, as `PackSelectionScreen`'s watcher does; the selection is kept. - **Done** keeps the selection for the world (`applyNewPackConfig`). **Create New World** copies the folder's packs into `<world>/datapacks` and writes `datapacks.json` with the selection enabled and the rest disabled (`copyTempDataPackDirToNewWorld`). That is the file `/datapack` and the launcher's data pack page already use. **Cancel** deletes the folder (`removeTempDataPackDir`). - Worlds created without opening the screen are unchanged: no `datapacks/` folder, no `datapacks.json`. How it plugs in: the More tab's button returns `title::Action::DataPacks`. The game opens the options UI's existing Packs page in a data-pack mode (`OptionsUi::open_data_packs`), so the search box, scrolling, the incompatible-pack confirm and key handling come with it, from both the startup menu and the title. `PackScreen::new` now takes its title. Not included: - **Experiment (feature) packs** aren't offered, since Horizon has no experiments (the Experiments button stays off). - **Files dropped on the window** aren't added (`onFilesDrop`); the resource pack screen doesn't take them yet either. - **Old-format packs** are listed as incompatible and can be selected after vanilla's confirm, but nothing upgrades them. A 26.2 → 26.3 data pack upgrader is coming in separate PRs. - **`level.dat`'s `DataPacks`** isn't written; the game reads `datapacks.json`. ## Vanilla reference - `CreateWorldScreen`: `openDataPackSelectionScreen`, `getDataPackSelectionSettings` (`mcworld-` temp folder, `ServerPacksSource.createPackRepository`), `copyTempDataPackDirToNewWorld`, `removeTempDataPackDir`, `applyNewPackConfig`. - `PackSelectionScreen`, with its watcher's reload. - `ServerPacksSource`: `VANILLA_PACK_INFO` (`dataPack.vanilla.name`/`description`), `VANILLA_SELECTION_CONFIG` (not required, bottom, not fixed), `FolderRepositorySource` with `PackSource.WORLD`. - **Harness:** `tools/test_pack_screen_parity.py` now runs every fourth case under `dataPack.title` (the oracle and `pack_screen_fixture` take the title from the case). On this branch: **3000/3000 pack screens match**, 750 of them under `dataPack.title`. - **In game** (fast build, offscreen, driven by `horizon-ctl`): Singleplayer → Create World → More → Data Packs, a one-function test pack copied into the folder, selected, Done, Create New World. - `datapacks.json` is `{"enabled":["vanilla","file/Hello Pack"],"disabled":[]}`. - `/function demo:hello` runs the pack's function. - The `mcworld-` folder is gone afterwards. - Unit tests: `datapack::tests::create_world_installs_its_packs` and the More-tab flow in `title::tests`. ## Self-check Run on Windows. The failures are the ones `main` has on Windows: two Rust tests (crash stack paths, `session_lock_is_exclusive`), and two Python tests (a symlink needing a Windows privilege, a `~/code/...` path). The parity harness above was run separately. **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on DESKTOP-LT6RAH8, against upstream/main at 07e4a8665, 27 min 0 s) | Check | Result | | --- | --- | | Scope | ✅ 13 files, +367 −24 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 401 run, FAILED (failures=1, errors=1, skipped=1) (3 min 44 s) | | rustfmt | ✅ (15 s) | | clippy | ✅ (4 min 48 s) | | tests: horizon-client | ❌ 1095 passed, 2 failed (16 min 4 s) | | doc tests | ✅ 0 passed (1 min 45 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Suggested label: `feature`. ## Screenshots Before: the More tab's Data Packs button was disabled. After, the screen with a pack in its folder, then with it selected: ![Data Packs screen, pack available](https://gist.githubusercontent.com/ThatCakeIsAPie/ddbd4219650a0b25552b80a9de2ebaaa/raw/f0ef6d870bd96ebe6346af2562834095990905ec/data-packs-available.png) ![Data Packs screen, pack selected](https://gist.githubusercontent.com/ThatCakeIsAPie/ddbd4219650a0b25552b80a9de2ebaaa/raw/a5b36cc1b5e456fa5b73814c5ec10c2c60983aa4/data-packs-selected.png) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:08:46 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#4902
No description provided.