[PR #4957] [MERGED] Create World: the world's enabled features persist in level.dat #5972

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

📋 Pull Request Information

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

Base: main ← Head: feat/enabled-features


📝 Commits (10+)

  • a04d8f1 World save: a vanilla-only enabled_features list leaves the tag out
  • 6d88762 Integrated server: packed_biomes gets the resources root back
  • dbfc38a Create World: the preparing read loads the chosen packs and takes no input
  • 162b972 Merge the stack below (main merged) into #4948
  • 8445b8d Create World preparing: keep the error screen, block typing, fix doc placement
  • 0839397 Merge the stack below (main merged) into #4957
  • c25c063 Merge the stack below (main merged) into #4948
  • 50c8a09 Merge fixes: the Data Packs reopen takes main's event loop, and the keyboard test passes the preparing screen
  • 2f60ce6 Merge the stack below (main merged) into #4957
  • d5aef59 Merge main into #4948

📊 Changes

5 files changed (+269 additions, -14 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+54 -8)
📝 crates/horizon-client/src/game/world_loading.rs (+21 -0)
📝 crates/horizon-client/src/save.rs (+47 -1)
📝 crates/horizon-client/src/title.rs (+37 -2)
📝 crates/horizon-client/src/title/tests.rs (+110 -3)

📄 Description

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

What and why

Vanilla's level.dat carries WorldDataConfiguration's enabled_features flat in the Data compound — Horizon wrote nothing, so a world made with experiments told vanilla nothing and forgot its flags itself.

  • Level.enabled_features is written at creation: the flags of the picked feature packs over vanilla (FeatureFlags.REGISTRY's codec writes the whole set, minecraft:vanilla included; the tag is omitted when the flags are the default, as the codec's lenient field is).
  • It is read back from level.dat, so a vanilla-made world keeps its flags when Horizon reopens and re-saves it.

The behaviors behind the three flags (minecart improvements, redstone experiments, trade rebalance) are still separate work; this is the data they will gate on.

Stacked on #4948 (← #4619 ← #4577): the creation site is the block those PRs add.

Vanilla reference

Decompiled from the 26.3 client jar (Vineflower): WorldDataConfiguration.MAP_CODEC (DataPacks + enabled_features, both lenient optional, stored flat by PrimaryLevelData's tag.store), FeatureFlags (the registry, isExperimental, DEFAULT_FLAGS = VANILLA_SET), FeatureFlagRegistry.codec (Identifier.CODEC.listOf(), toNames writing every flag in the set).

Self-check

Check Result
rustfmt ✅
clippy (-D warnings) ✅
tests ✅ client 906, render 688, world 227 — all passing (a temporary write/read round-trip test verified both the tag's presence with the full set and its absence for a default world; removed from the final diff)

Screenshots

Not needed (data format only).


🔄 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/4957 **Author:** [@masa-masa-0314](https://github.com/masa-masa-0314) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/enabled-features` --- ### 📝 Commits (10+) - [`a04d8f1`](https://github.com/horizon-rust/horizon/commit/a04d8f11e5052f5a0af8860d3417ddf7fbdb62e1) World save: a vanilla-only enabled_features list leaves the tag out - [`6d88762`](https://github.com/horizon-rust/horizon/commit/6d88762c62d55f504b64a44f9bed15433e893f80) Integrated server: packed_biomes gets the resources root back - [`dbfc38a`](https://github.com/horizon-rust/horizon/commit/dbfc38af70d43665acf893d040f4cd2b943e6aa3) Create World: the preparing read loads the chosen packs and takes no input - [`162b972`](https://github.com/horizon-rust/horizon/commit/162b972ac322659e0a155f56d61ab1c93f482079) Merge the stack below (main merged) into #4948 - [`8445b8d`](https://github.com/horizon-rust/horizon/commit/8445b8d3e743a660a80f0de7aa21f8f0ee1e2851) Create World preparing: keep the error screen, block typing, fix doc placement - [`0839397`](https://github.com/horizon-rust/horizon/commit/08393970219abe8f0f8a46aa3bdfdd60a5ad4fa0) Merge the stack below (main merged) into #4957 - [`c25c063`](https://github.com/horizon-rust/horizon/commit/c25c063045b2a6d6acb6fd12de116899bc565747) Merge the stack below (main merged) into #4948 - [`50c8a09`](https://github.com/horizon-rust/horizon/commit/50c8a09d23bfe49c0db6b27c22c3599476928249) Merge fixes: the Data Packs reopen takes main's event loop, and the keyboard test passes the preparing screen - [`2f60ce6`](https://github.com/horizon-rust/horizon/commit/2f60ce64570464bbaaae19c20bc4dd4faae23462) Merge the stack below (main merged) into #4957 - [`d5aef59`](https://github.com/horizon-rust/horizon/commit/d5aef59f19433e1603308a27f84de68a28ddefa2) Merge main into #4948 ### 📊 Changes **5 files changed** (+269 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+54 -8) 📝 `crates/horizon-client/src/game/world_loading.rs` (+21 -0) 📝 `crates/horizon-client/src/save.rs` (+47 -1) 📝 `crates/horizon-client/src/title.rs` (+37 -2) 📝 `crates/horizon-client/src/title/tests.rs` (+110 -3) </details> ### 📄 Description > 🤖 Opened by masa-masa-0314's AI agent (ZCode), not by masa-masa-0314 personally. ## What and why Vanilla's level.dat carries `WorldDataConfiguration`'s `enabled_features` flat in the Data compound — Horizon wrote nothing, so a world made with experiments told vanilla nothing and forgot its flags itself. - `Level.enabled_features` is **written at creation**: the flags of the picked feature packs over vanilla (`FeatureFlags.REGISTRY`'s codec writes the whole set, `minecraft:vanilla` included; the tag is omitted when the flags are the default, as the codec's lenient field is). - It is **read back** from level.dat, so a vanilla-made world keeps its flags when Horizon reopens and re-saves it. The behaviors behind the three flags (minecart improvements, redstone experiments, trade rebalance) are still separate work; this is the data they will gate on. Stacked on #4948 (← #4619 ← #4577): the creation site is the block those PRs add. ## Vanilla reference Decompiled from the 26.3 client jar (Vineflower): `WorldDataConfiguration.MAP_CODEC` (`DataPacks` + `enabled_features`, both lenient optional, stored flat by `PrimaryLevelData`'s `tag.store`), `FeatureFlags` (the registry, `isExperimental`, `DEFAULT_FLAGS` = `VANILLA_SET`), `FeatureFlagRegistry.codec` (`Identifier.CODEC.listOf()`, `toNames` writing every flag in the set). ## Self-check | Check | Result | | --- | --- | | rustfmt | ✅ | | clippy (`-D warnings`) | ✅ | | tests | ✅ client 906, render 688, world 227 — all passing (a temporary write/read round-trip test verified both the tag's presence with the full set and its absence for a default world; removed from the final diff) | ## Screenshots Not needed (data format only). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:16:18 +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#5972
No description provided.