[PR #5458] [MERGED] The Debug world preset: a grid of every block state #6300

Closed
opened 2026-11-03 06:17:58 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5458
Author: @xFedeT
Created: 10/31/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: feat/debug-world


📝 Commits (2)

📊 Changes

10 files changed (+255 additions, -6 deletions)

View changed files

➕ crates/horizon-client/src/debugworld.rs (+131 -0)
📝 crates/horizon-client/src/game.rs (+20 -2)
📝 crates/horizon-client/src/game/commands.rs (+12 -0)
📝 crates/horizon-client/src/game/lan.rs (+1 -0)
📝 crates/horizon-client/src/game/lightning.rs (+1 -1)
📝 crates/horizon-client/src/game/natural_spawning.rs (+4 -0)
📝 crates/horizon-client/src/game/world_loading.rs (+24 -1)
📝 crates/horizon-client/src/lan/hub.rs (+4 -1)
📝 crates/horizon-client/src/lib.rs (+1 -0)
📝 crates/horizon-client/src/save.rs (+57 -1)

📄 Description

🤖 Opened by xFedeT's AI agent (Claude Code, Claude Sonnet 5.5), not by xFedeT personally.

Part of #3517: the DebugLevelSource row. A world whose overworld is minecraft:debug (the debug_all_block_states preset) fell back to a normal world.

Vanilla

  • DebugLevelSource.applyBiomeDecoration: a barrier at y 60 and getBlockStateFor(x, z) at y 70 for every column; buildTerrain builds nothing, plains is the only biome.
  • getBlockStateFor: ALL_BLOCKS is every state of every block in registry order; GRID_WIDTH = ceil(sqrt(size)), GRID_HEIGHT = ceil(size / width); a column holds a state only when x and z are positive and odd, at index (x/2) * width + z/2 while that is within the grid and the list, air otherwise.
  • Level.isDebug (the overworld's generator, for every dimension): Level.setBlock returns false on a server level; ServerLevel.tick runs no scheduled block or fluid ticks and ServerChunkCache.tickChunks no random ticks or natural spawning; /setblock, /fill and /clone throw their failed error; the login and respawn packets carry isDebug.

What changes

  • WorldPreset::Debug (minecraft:debug_all_block_states): written as {type: minecraft:debug} in world_gen_settings, read back by of_generator and of_id (a level-type or a data pack names it); the create screen's button does not cycle to it (vanilla offers it only through Alt on that button, which is not ported).
  • debugworld::DebugTerrain: the generator. Block states are numbered in ALL_BLOCKS order, so a state's id is its index; grid and grid_state are the two formulas.
  • The server level refuses block writes (GameLevel::set_raw), runs no scheduled, random or natural-spawning ticks and no thunder strikes, /setblock, /fill and /clone fail, and the hub's login packet says debug.

Verification

  • debugworld::tests::the_grid_holds_a_state_every_other_block (the formulas on known sizes), the_debug_preset_is_saved_and_read_back (id, saved generator, read back, not in the button's cycle); the world stability test includes the preset.
  • A real run on the server thread (a world whose world_gen_settings hold the Debug preset): the grid is drawn at y 70 over the barriers at y 60; (1,1), (1,3), (1,5), (1,7), (1,9) at y 70 are air, stone, granite, polished granite, diorite, as in vanilla; /setblock and /fill answer "Could not place the block" and "No blocks were filled".

the debug world: every block state on a grid

  • pr_ready --quick passes in full (fmt, clippy, Python tests, 1543 horizon-client tests).

🤖 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/5458 **Author:** [@xFedeT](https://github.com/xFedeT) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/debug-world` --- ### 📝 Commits (2) - [`e2b71fa`](https://github.com/horizon-rust/horizon/commit/e2b71fa6927ca03da1dd780f7ed6d06badbd5123) The Debug world preset: a grid of every block state - [`acc1fdc`](https://github.com/horizon-rust/horizon/commit/acc1fdceb50f63eb27559011a90e47244e07a0fc) Merge main into #5458 ### 📊 Changes **10 files changed** (+255 additions, -6 deletions) <details> <summary>View changed files</summary> ➕ `crates/horizon-client/src/debugworld.rs` (+131 -0) 📝 `crates/horizon-client/src/game.rs` (+20 -2) 📝 `crates/horizon-client/src/game/commands.rs` (+12 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+1 -0) 📝 `crates/horizon-client/src/game/lightning.rs` (+1 -1) 📝 `crates/horizon-client/src/game/natural_spawning.rs` (+4 -0) 📝 `crates/horizon-client/src/game/world_loading.rs` (+24 -1) 📝 `crates/horizon-client/src/lan/hub.rs` (+4 -1) 📝 `crates/horizon-client/src/lib.rs` (+1 -0) 📝 `crates/horizon-client/src/save.rs` (+57 -1) </details> ### 📄 Description > 🤖 Opened by xFedeT's AI agent (Claude Code, Claude Sonnet 5.5), not by xFedeT personally. Part of #3517: the `DebugLevelSource` row. A world whose overworld is `minecraft:debug` (the `debug_all_block_states` preset) fell back to a normal world. ## Vanilla - `DebugLevelSource.applyBiomeDecoration`: a barrier at y 60 and `getBlockStateFor(x, z)` at y 70 for every column; `buildTerrain` builds nothing, plains is the only biome. - `getBlockStateFor`: `ALL_BLOCKS` is every state of every block in registry order; `GRID_WIDTH = ceil(sqrt(size))`, `GRID_HEIGHT = ceil(size / width)`; a column holds a state only when x and z are positive and odd, at index `(x/2) * width + z/2` while that is within the grid and the list, air otherwise. - `Level.isDebug` (the overworld's generator, for every dimension): `Level.setBlock` returns false on a server level; `ServerLevel.tick` runs no scheduled block or fluid ticks and `ServerChunkCache.tickChunks` no random ticks or natural spawning; `/setblock`, `/fill` and `/clone` throw their `failed` error; the login and respawn packets carry `isDebug`. ## What changes - `WorldPreset::Debug` (`minecraft:debug_all_block_states`): written as `{type: minecraft:debug}` in `world_gen_settings`, read back by `of_generator` and `of_id` (a `level-type` or a data pack names it); the create screen's button does not cycle to it (vanilla offers it only through Alt on that button, which is not ported). - `debugworld::DebugTerrain`: the generator. Block states are numbered in `ALL_BLOCKS` order, so a state's id is its index; `grid` and `grid_state` are the two formulas. - The server level refuses block writes (`GameLevel::set_raw`), runs no scheduled, random or natural-spawning ticks and no thunder strikes, `/setblock`, `/fill` and `/clone` fail, and the hub's login packet says `debug`. ## Verification - `debugworld::tests::the_grid_holds_a_state_every_other_block` (the formulas on known sizes), `the_debug_preset_is_saved_and_read_back` (id, saved generator, read back, not in the button's cycle); the world stability test includes the preset. - A real run on the server thread (a world whose `world_gen_settings` hold the Debug preset): the grid is drawn at y 70 over the barriers at y 60; `(1,1)`, `(1,3)`, `(1,5)`, `(1,7)`, `(1,9)` at y 70 are air, stone, granite, polished granite, diorite, as in vanilla; `/setblock` and `/fill` answer "Could not place the block" and "No blocks were filled". ![the debug world: every block state on a grid](https://raw.githubusercontent.com/xFedeT/horizon/pr-screenshots/3517/debug-world.png) - `pr_ready --quick` passes in full (fmt, clippy, Python tests, 1543 `horizon-client` tests). 🤖 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 06:17:58 +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#6300
No description provided.