[PR #4619] [MERGED] Create World: the Experiments screen and the resources' feature packs #5732

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4619
Author: @masa-masa-0314
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: feat/experiments-screen


📝 Commits (10+)

  • a3dc4c7 Biomes: the palette holds a world's biomes too
  • d2145ac Commands: a world's packs complete and match their biomes and tags
  • 4885673 Data packs: the world's chunks and the game read one biome table
  • 6eada86 Data packs: one pack list builds the biomes, the worldgen and the commands
  • 34be912 Biomes: the table survives world switches, and tags nest
  • 69cc8ab Merge remote-tracking branch 'origin/main' into pr-4577
  • 9950e27 Fix packed_biomes call after merging main; restore world_worldgen_overrides's doc comment
  • 725a91b Data packs: pack tag overlays reach TagLoader's ids
  • 73d4259 Experiments: the switches commit on Done, and Cancel drops them
  • dd8c07b Re-Create keeps the world's feature packs

📊 Changes

3 files changed (+80 additions, -13 deletions)

View changed files

📝 crates/horizon-client/src/title.rs (+23 -11)
📝 crates/horizon-items/src/items.rs (+4 -2)
📝 crates/horizon-world/src/loot.rs (+53 -0)

📄 Description

🤖 Opened by masa-masa-0314's AI agent (ZCode), not by masa-masa-0314 personally.

What and why

Create World's Experiments button was drawn disabled (// Experiments have no screen yet). It now opens vanilla's ExperimentsScreen, and together with the Data Packs screen the picked feature packs actually reach the world.

  • The Experiments screen (title/experiments.rs) follows vanilla's geometry: every feature pack the resources root ships under data/minecraft/datapacks (ServerPacksSource, PackSource.FEATURE), each with a 44-wide on/off switch at the right of its row, its description grey underneath, the red selectWorld.experiments.info warning wrapped to 310 and centred, Done and Cancel in the footer — HeaderAndFooterLayout + SwitchGrid layout. Switching a pack adds or removes its id in the world's data pack selection; Done keeps the other packs and rejoins the picked feature packs last, reversed (onDone); Cancel and Escape leave the selection as it was.
  • Dropping a pack on the window (PackSelectionScreen.onFilesDrop): a zip, a pack folder, or a folder holding exactly one pack (PackDetector) is copied into the create screen's pack folder, where the Data Packs screen's existing watcher lists it within a second; anything else is refused and logged. The Data Packs screen offers the feature packs too, available at the bottom and off until picked.
  • Resolution: a feature pack lives in the game's files, not in saves/<world>/datapacks, so the pack stack never saw one. datapack::feature_packs / discover_with_features add them to the world's repository (pack_stack, packed_biomes, world_worldgen_overrides — the one list #4577 unified), and a feature pack stays off unless the world enabled it (vanilla starts PackSource.FEATURE unselected), so existing worlds behave exactly as before.
  • Persistence: the world's selection is written to datapacks.json (the pack stack's file) at creation, and into level.dat's DataPacks (DataPackConfig), so a vanilla client reading the world sees the same selection.
  • /datapack shows an enabled feature pack with the feature source and can disable it again; enable still refuses one (commands.datapack.enable.failed.no_flags) — the three flags' behaviors (minecart speed, redstone rules, trade rebalance) are not implemented yet, but the packs' data files (trade_rebalance's loot tables and tags) reach the content tables through the pack stack.

Stacked on #4577 (feat/worldgen-pack-content): the resolution goes through the unified pack list that PR builds. Supersedes #4337, which carried the Experiments screen and the drop handling without the resolution chain — that commit is folded in here, on top of #4577, with the feature packs now reaching the world's pack stack, worldgen, content tables and level.dat.

Headless verification (/datapack list in a world whose datapacks.json enables trade_rebalance):

/datapack list => There are 2 data pack(s) enabled: [vanilla (built-in)], [trade_rebalance (feature)]
                  There are 2 data pack(s) available: [minecart_improvements (feature)], [redstone_experiments (feature)]
/datapack disable trade_rebalance => Disabling data pack [trade_rebalance (feature)]
/datapack list => There are 1 data pack(s) enabled: [vanilla (built-in)]
                  There are 3 data pack(s) available: [minecart_improvements (feature)], [redstone_experiments (feature)], [trade_rebalance (feature)]

Vanilla reference

Decompiled from the 26.3 client jar (Vineflower):

  • net.minecraft.client.gui.screens.worldselection.ExperimentsScreen — switches only for PackSource.FEATURE packs, getHumanReadableTitle (dataPack.<id>.name, else the pack title), the red INFO text, SwitchGrid.builder(299).withInfoUnderneath(2, true).withRowSpacing(4), Done/Cancel footer, onDone's reversed rejoin, onClose.
  • net.minecraft.client.gui.screens.worldselection.CreateWorldScreen — openExperimentsScreen/openDataPackSelectionScreen share the repository; MoreTab lays out Game Rules, Experiments, Data Packs (210 wide each); onFilesDrop → PackDetector → copy into the temp folder; createNewWorld copies the temp packs into the world (createNewWorldDirectory).
  • net.minecraft.client.gui.screens.worldselection.ConfirmExperimentalFeaturesScreen — read for the flow, not yet ported: vanilla shows it when a Data Packs-screen Done would enable experimental flags. Follow-up.
  • net.minecraft.world.flag.FeatureFlags / FeatureFlagsMetadataSection — a feature pack declares its flags in pack.mcmeta's features.enabled; none are enabled by default (DEFAULT_FLAGS).

Self-check

pr_ready (tools/pr_ready.py --base upstream/main) — the numbers cover this branch and #4577 together, since this PR is stacked on it. The branch is now rebased onto upstream/main at d5c4248f6, where the stack re-verified cleanly in a scratch worktree with #4813's two-line Windows build fix beneath it (that commit breaks cargo check/clippy/test on Windows for every branch): client 868, render 631 and world 225 tests all passing, and the probe above run on the rebuilt binary:

Check Result
Scope ⚠️ 29 files, +659 −132; 791 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 481 run, FAILED (errors=1, skipped=1) (1 min 49 s)
rustfmt ✅ (14 s)
clippy ✅ (1 min 2 s)
tests: horizon-client, horizon-client-render ❌ 791 passed, 1 failed (2 min 33 s)
doc tests ✅ 0 passed (9 s)
  • The one failing test, title::tests::each_world_preset_writes_its_own_generator, uses minecraft:normal as a directory name, which Windows rejects; it fails the same on clean upstream/main here.
  • The Python suite's error is test_perf_bench.PortabilityTests.test_report_without_a_load_average (a GBK/UTF-8 decode issue in this machine's Python 3.13 subprocess handling), and dedicated_server is flaky here; both fail the same on clean upstream/main on this machine. This branch's commit also updates title::tests::create_world_tabs_follow_vanilla_and_their_choices_reach_the_action, which asserted the Experiments button disabled.
  • The scope count covers #4577's four commits plus this one; on its own this commit touches 10 files (+491 −67). The parts ship together because the Experiments screen and the drop handling are useless without the resolution that puts the picked feature packs into the world's pack stack, worldgen and content tables.

Screenshots

Not included: this machine's offscreen renderer draws a blank window. The user tests the screens in-game; the probe output above shows the resolution half.


🔄 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/4619 **Author:** [@masa-masa-0314](https://github.com/masa-masa-0314) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/experiments-screen` --- ### 📝 Commits (10+) - [`a3dc4c7`](https://github.com/horizon-rust/horizon/commit/a3dc4c74abe425c47ed6a41336bcc61bda4d5a45) Biomes: the palette holds a world's biomes too - [`d2145ac`](https://github.com/horizon-rust/horizon/commit/d2145ac8205ad3b44e6cbc3d37002cf433d4bcd6) Commands: a world's packs complete and match their biomes and tags - [`4885673`](https://github.com/horizon-rust/horizon/commit/48856738b0d12ad9e283fc535eb3d702ba3816f1) Data packs: the world's chunks and the game read one biome table - [`6eada86`](https://github.com/horizon-rust/horizon/commit/6eada864b195708527f9445822568bb5d1f482f5) Data packs: one pack list builds the biomes, the worldgen and the commands - [`34be912`](https://github.com/horizon-rust/horizon/commit/34be9125df8c2e2a49d3ee9873c56e2bbeefb811) Biomes: the table survives world switches, and tags nest - [`69cc8ab`](https://github.com/horizon-rust/horizon/commit/69cc8ab35b302cec2bb1420814909a0804ea2bab) Merge remote-tracking branch 'origin/main' into pr-4577 - [`9950e27`](https://github.com/horizon-rust/horizon/commit/9950e27f87d7efd8f589be401a1be5b04c5fc76f) Fix packed_biomes call after merging main; restore world_worldgen_overrides's doc comment - [`725a91b`](https://github.com/horizon-rust/horizon/commit/725a91b23fd807382f75e7f84aee17ec18589ac1) Data packs: pack tag overlays reach TagLoader's ids - [`73d4259`](https://github.com/horizon-rust/horizon/commit/73d42592e381f75a10fba492214014335966d1f6) Experiments: the switches commit on Done, and Cancel drops them - [`dd8c07b`](https://github.com/horizon-rust/horizon/commit/dd8c07b5376ad53a91b3b587d38399318b767f3f) Re-Create keeps the world's feature packs ### 📊 Changes **3 files changed** (+80 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/title.rs` (+23 -11) 📝 `crates/horizon-items/src/items.rs` (+4 -2) 📝 `crates/horizon-world/src/loot.rs` (+53 -0) </details> ### 📄 Description > 🤖 Opened by masa-masa-0314's AI agent (ZCode), not by masa-masa-0314 personally. ## What and why Create World's **Experiments** button was drawn disabled (`// Experiments have no screen yet`). It now opens vanilla's ExperimentsScreen, and together with the Data Packs screen the picked feature packs actually reach the world. - The **Experiments screen** (`title/experiments.rs`) follows vanilla's geometry: every feature pack the resources root ships under `data/minecraft/datapacks` (`ServerPacksSource`, `PackSource.FEATURE`), each with a 44-wide on/off switch at the right of its row, its description grey underneath, the red `selectWorld.experiments.info` warning wrapped to 310 and centred, Done and Cancel in the footer — `HeaderAndFooterLayout` + `SwitchGrid` layout. Switching a pack adds or removes its id in the world's data pack selection; Done keeps the other packs and rejoins the picked feature packs last, reversed (`onDone`); Cancel and Escape leave the selection as it was. - **Dropping a pack on the window** (`PackSelectionScreen.onFilesDrop`): a zip, a pack folder, or a folder holding exactly one pack (`PackDetector`) is copied into the create screen's pack folder, where the Data Packs screen's existing watcher lists it within a second; anything else is refused and logged. The Data Packs screen offers the feature packs too, available at the bottom and off until picked. - **Resolution**: a feature pack lives in the game's files, not in `saves/<world>/datapacks`, so the pack stack never saw one. `datapack::feature_packs` / `discover_with_features` add them to the world's repository (`pack_stack`, `packed_biomes`, `world_worldgen_overrides` — the one list #4577 unified), and a feature pack **stays off unless the world enabled it** (vanilla starts `PackSource.FEATURE` unselected), so existing worlds behave exactly as before. - **Persistence**: the world's selection is written to `datapacks.json` (the pack stack's file) at creation, and into `level.dat`'s `DataPacks` (`DataPackConfig`), so a vanilla client reading the world sees the same selection. - `/datapack` shows an enabled feature pack with the feature source and can disable it again; `enable` still refuses one (`commands.datapack.enable.failed.no_flags`) — the three flags' behaviors (minecart speed, redstone rules, trade rebalance) are not implemented yet, but the packs' data files (trade_rebalance's loot tables and tags) reach the content tables through the pack stack. Stacked on #4577 (`feat/worldgen-pack-content`): the resolution goes through the unified pack list that PR builds. Supersedes #4337, which carried the Experiments screen and the drop handling without the resolution chain — that commit is folded in here, on top of #4577, with the feature packs now reaching the world's pack stack, worldgen, content tables and `level.dat`. Headless verification (`/datapack list` in a world whose `datapacks.json` enables `trade_rebalance`): ``` /datapack list => There are 2 data pack(s) enabled: [vanilla (built-in)], [trade_rebalance (feature)] There are 2 data pack(s) available: [minecart_improvements (feature)], [redstone_experiments (feature)] /datapack disable trade_rebalance => Disabling data pack [trade_rebalance (feature)] /datapack list => There are 1 data pack(s) enabled: [vanilla (built-in)] There are 3 data pack(s) available: [minecart_improvements (feature)], [redstone_experiments (feature)], [trade_rebalance (feature)] ``` ## Vanilla reference Decompiled from the 26.3 client jar (Vineflower): - `net.minecraft.client.gui.screens.worldselection.ExperimentsScreen` — switches only for `PackSource.FEATURE` packs, `getHumanReadableTitle` (`dataPack.<id>.name`, else the pack title), the red INFO text, `SwitchGrid.builder(299).withInfoUnderneath(2, true).withRowSpacing(4)`, Done/Cancel footer, `onDone`'s reversed rejoin, `onClose`. - `net.minecraft.client.gui.screens.worldselection.CreateWorldScreen` — `openExperimentsScreen`/`openDataPackSelectionScreen` share the repository; `MoreTab` lays out Game Rules, Experiments, Data Packs (210 wide each); `onFilesDrop` → `PackDetector` → copy into the temp folder; `createNewWorld` copies the temp packs into the world (`createNewWorldDirectory`). - `net.minecraft.client.gui.screens.worldselection.ConfirmExperimentalFeaturesScreen` — read for the flow, not yet ported: vanilla shows it when a Data Packs-screen Done would enable experimental flags. Follow-up. - `net.minecraft.world.flag.FeatureFlags` / `FeatureFlagsMetadataSection` — a feature pack declares its flags in `pack.mcmeta`'s `features.enabled`; none are enabled by default (`DEFAULT_FLAGS`). ## Self-check **pr_ready** (`tools/pr_ready.py --base upstream/main`) — the numbers cover this branch and #4577 together, since this PR is stacked on it. The branch is now rebased onto `upstream/main` at `d5c4248f6`, where the stack re-verified cleanly in a scratch worktree with #4813's two-line Windows build fix beneath it (that commit breaks `cargo check`/`clippy`/`test` on Windows for every branch): client 868, render 631 and world 225 tests all passing, and the probe above run on the rebuilt binary: | Check | Result | | --- | --- | | Scope | ⚠️ 29 files, +659 −132; 791 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 481 run, FAILED (errors=1, skipped=1) (1 min 49 s) | | rustfmt | ✅ (14 s) | | clippy | ✅ (1 min 2 s) | | tests: horizon-client, horizon-client-render | ❌ 791 passed, 1 failed (2 min 33 s) | | doc tests | ✅ 0 passed (9 s) | - The one failing test, `title::tests::each_world_preset_writes_its_own_generator`, uses `minecraft:normal` as a directory name, which Windows rejects; it fails the same on clean `upstream/main` here. - The Python suite's error is `test_perf_bench.PortabilityTests.test_report_without_a_load_average` (a GBK/UTF-8 decode issue in this machine's Python 3.13 subprocess handling), and `dedicated_server` is flaky here; both fail the same on clean `upstream/main` on this machine. This branch's commit also updates `title::tests::create_world_tabs_follow_vanilla_and_their_choices_reach_the_action`, which asserted the Experiments button disabled. - The scope count covers #4577's four commits plus this one; on its own this commit touches 10 files (+491 −67). The parts ship together because the Experiments screen and the drop handling are useless without the resolution that puts the picked feature packs into the world's pack stack, worldgen and content tables. ## Screenshots Not included: this machine's offscreen renderer draws a blank window. The user tests the screens in-game; the probe output above shows the resolution half. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:14:37 +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#5732
No description provided.