[PR #733] [MERGED] Dedicated server: read level-type, generator-settings and generate-structures #2764

Closed
opened 2026-11-02 15:58:52 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/733
Author: @ludovic111
Created: 10/17/2026
Status: ✅ Merged
Merged: 10/17/2026
Merged by: @ludovic111

Base: main ← Head: fix/server-level-type


📝 Commits (2)

  • 3cae8d1 Dedicated server: level-type, generator-settings and generate-structures for a new world
  • a79baaa server_world_gen: an unknown biome logs vanilla's 'Unknown biome, defaulting to plains'

📊 Changes

4 files changed (+420 additions, -25 deletions)

View changed files

📝 crates/horizon-client/src/flatgen.rs (+175 -0)
📝 crates/horizon-client/src/game/dedicated.rs (+79 -2)
📝 crates/horizon-client/src/save.rs (+34 -23)
➕ tools/test_server_world_gen_parity.py (+132 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Horizon's dedicated server ignored level-type, generator-settings and generate-structures: a new world was always the normal preset, so level-type=flat gave a normal world (server-host-3 found it).

What it does now (DedicatedServerProperties.WorldDimensionData, for a world that doesn't exist yet)

  • level-type picks the world preset: flat, minecraft:flat, FLAT (lower-cased, as vanilla does) or normal.
    • A name that isn't a preset logs vanilla's warning, Failed to parse level-type <name>, defaulting to minecraft:normal, and makes a normal world.
    • large_biomes, amplified, single_biome_surface and debug_all_block_states are real presets that Horizon doesn't generate yet. They log Horizon doesn't generate the <preset> world preset yet: using minecraft:normal and make a normal world.
  • generator-settings is read for a flat world as FlatLevelGeneratorSettings: layers, biome, lakes and features.
    • Settings without layers use the preset's classic layers. That includes server.properties' default {}. Vanilla logs No key layers in MapLike[{}] there, and so does Horizon.
    • A layer with an unknown block is logged (Unknown registry key in ResourceKey[minecraft:root / minecraft:block]: …) and left out, as the codec's partial result leaves it.
    • A missing or unknown biome logs Unknown biome, defaulting to plains.
    • Layers taller than 4064 in total fall back to the classic layers.
  • generate-structures is stored in world_gen_settings.dat.

The settings are written to world_gen_settings.dat before the world opens, so streaming and the spawn search read them. The lines are logged on vanilla's thread (Worker-Main) before "Starting minecraft server", as vanilla does. An existing world is never changed.

Not in this PR: Horizon's terrain generator doesn't read generate_structures yet, so structures still generate when it is false. Single player's "Generate Structures" button has the same gap.

New harness: server_world_gen
Five server.properties cases, each run on vanilla's server and on Horizon's (start, Done, stop):

  • flat with the default settings;
  • minecraft:flat with custom layers (one of them an unknown block), desert, lakes and features;
  • FLAT with an unknown biome;
  • minecraft:normal with generate-structures=false and a text seed;
  • an unknown level-type.

Compared exactly: world_gen_settings.dat (tag types included) and the Worker-Main warnings and errors.

Checks
Run on one branch holding main and both of today's server fixes (#733 and #734), then rechecked after merging main at 1e655afc:

  • cargo fmt --all --check: OK.
  • cargo clippy --workspace --all-targets -- -D warnings: 0 warnings (-p horizon-client again after the merge).
  • cargo test -p horizon-client --lib: 824 passed, 0 failed, 11 ignored.
  • tools/parity.py --changed origin/main: 89 of 89 harnesses passed, including server_world_gen and dedicated_server. world_spawn passed on its retry without reused oracle results.

🤖 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/733 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/17/2026 **Status:** ✅ Merged **Merged:** 10/17/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/server-level-type` --- ### 📝 Commits (2) - [`3cae8d1`](https://github.com/horizon-rust/horizon/commit/3cae8d1d736dc2eebb638012d0d3c699b3015937) Dedicated server: level-type, generator-settings and generate-structures for a new world - [`a79baaa`](https://github.com/horizon-rust/horizon/commit/a79baaa0319eb610e5a93511a5ef56ddd31aeb07) server_world_gen: an unknown biome logs vanilla's 'Unknown biome, defaulting to plains' ### 📊 Changes **4 files changed** (+420 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/flatgen.rs` (+175 -0) 📝 `crates/horizon-client/src/game/dedicated.rs` (+79 -2) 📝 `crates/horizon-client/src/save.rs` (+34 -23) ➕ `tools/test_server_world_gen_parity.py` (+132 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Horizon's dedicated server ignored `level-type`, `generator-settings` and `generate-structures`: a new world was always the normal preset, so `level-type=flat` gave a normal world (server-host-3 found it). **What it does now** (DedicatedServerProperties.WorldDimensionData, for a world that doesn't exist yet) - **`level-type`** picks the world preset: `flat`, `minecraft:flat`, `FLAT` (lower-cased, as vanilla does) or `normal`. - A name that isn't a preset logs vanilla's warning, `Failed to parse level-type <name>, defaulting to minecraft:normal`, and makes a normal world. - `large_biomes`, `amplified`, `single_biome_surface` and `debug_all_block_states` are real presets that Horizon doesn't generate yet. They log `Horizon doesn't generate the <preset> world preset yet: using minecraft:normal` and make a normal world. - **`generator-settings`** is read for a flat world as FlatLevelGeneratorSettings: layers, biome, lakes and features. - Settings without `layers` use the preset's classic layers. That includes server.properties' default `{}`. Vanilla logs `No key layers in MapLike[{}]` there, and so does Horizon. - A layer with an unknown block is logged (`Unknown registry key in ResourceKey[minecraft:root / minecraft:block]: …`) and left out, as the codec's partial result leaves it. - A missing or unknown biome logs `Unknown biome, defaulting to plains`. - Layers taller than 4064 in total fall back to the classic layers. - **`generate-structures`** is stored in `world_gen_settings.dat`. The settings are written to `world_gen_settings.dat` before the world opens, so streaming and the spawn search read them. The lines are logged on vanilla's thread (`Worker-Main`) before "Starting minecraft server", as vanilla does. An existing world is never changed. **Not in this PR:** Horizon's terrain generator doesn't read `generate_structures` yet, so structures still generate when it is false. Single player's "Generate Structures" button has the same gap. **New harness: `server_world_gen`** Five server.properties cases, each run on vanilla's server and on Horizon's (start, `Done`, stop): - `flat` with the default settings; - `minecraft:flat` with custom layers (one of them an unknown block), desert, lakes and features; - `FLAT` with an unknown biome; - `minecraft:normal` with `generate-structures=false` and a text seed; - an unknown `level-type`. Compared exactly: `world_gen_settings.dat` (tag types included) and the `Worker-Main` warnings and errors. **Checks** Run on one branch holding `main` and both of today's server fixes (#733 and #734), then rechecked after merging `main` at `1e655afc`: - `cargo fmt --all --check`: OK. - `cargo clippy --workspace --all-targets -- -D warnings`: 0 warnings (`-p horizon-client` again after the merge). - `cargo test -p horizon-client --lib`: 824 passed, 0 failed, 11 ignored. - `tools/parity.py --changed origin/main`: 89 of 89 harnesses passed, including `server_world_gen` and `dedicated_server`. `world_spawn` passed on its retry without reused oracle results. 🤖 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-02 15:58:52 +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#2764
No description provided.