[PR #2072] [MERGED] Proto chunks: save placed block entities with their id #3980

Closed
opened 2026-11-03 04:13:45 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/proto-block-entity-id


📝 Commits (1)

  • 9a0fcda Proto chunks: save placed block entities with their id

📊 Changes

2 files changed (+75 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/vanillagen.rs (+8 -0)
📝 crates/horizon-client/tests/generation_saves.rs (+67 -0)

📄 Description

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

What and why

A structure can place block entity data that carries no type. A brushable block's data, for example, is only its loot table.

  • Finished chunks already got the id from the block.
  • Saved proto chunks did not.

When vanilla or Paper finish such a proto chunk, they log "Skipping block entity with invalid type" and drop the data. So suspicious sand and gravel at the edge of a pre-generated area (desert wells, desert pyramids, ocean ruins, trail ruins) lost their archaeology loot once the chunk was finished outside Horizon.

What changes:

  • VanillaTerrain's proto save writes each pending block entity with the id of its block.
  • It uses lan::chunks::block_entity_type, which already maps for example suspicious_sand to brushable_block.

Vanilla reference

  • ProtoChunk.getBlockEntityNbtForSaving / BlockEntity.saveWithFullMetadata: every pending block entity is saved with its type.
  • BlockEntity.loadStatic: the "Skipping block entity with invalid type" path.

Tests

  • New integration test tests/generation_saves.rs::saved_proto_block_entities_keep_their_id. It generates and saves the proto chunks around a cold ocean ruin of seed 12345 and checks that every saved block entity has an id, including the ruin's suspicious gravel with its archaeology/ loot table.
  • tools/test_block_entity_storage_parity.py passed on this branch: 78,251 lines match on client and server.
  • End to end: All fixes of this series (the five save PRs and the four structure-start PRs) merged onto main and run as a dedicated server, which pre-generated seed 12345, 4,096 chunks per dimension (radius 500 blocks), and the result was compared chunk by chunk with the same area from the pinned vanilla 26.3 server (compare.py, our own world-diff tool). Then the world was opened in Paper 26.3. Paper's log shows no exception and no skipped block entity. None of the 528 proto chunks per dimension holds a block entity without an id.

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on d2a09df18e70, against upstream/main at 57c5f8129, 3 min 32 s)

Check Result
Scope ✅ 2 files, +75 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (6 s)
clippy ✅ (25 s)
tests: horizon-client ✅ 1296 passed (2 min 58 s)
doc tests ✅ 0 passed (2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 324 affected, to run in CI (--quick): arrow, attribute_map_queries, auto_jump, biome_source_codec, biome_temperature, biome_weather, biome_zoom, block_blob, block_collision_scan, block_column, block_entity_anim, block_entity_render and 312 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/2072 **Author:** [@FusselTV](https://github.com/FusselTV) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/proto-block-entity-id` --- ### 📝 Commits (1) - [`9a0fcda`](https://github.com/horizon-rust/horizon/commit/9a0fcda3a9112d5aba832c7ae8f519f3ea6ab499) Proto chunks: save placed block entities with their id ### 📊 Changes **2 files changed** (+75 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/vanillagen.rs` (+8 -0) 📝 `crates/horizon-client/tests/generation_saves.rs` (+67 -0) </details> ### 📄 Description > 🤖 Opened by FusselTV's AI agent (Claude Code, Opus 5.5), not by FusselTV personally. ## What and why A structure can place block entity data that carries no type. A brushable block's data, for example, is only its loot table. - Finished chunks already got the `id` from the block. - Saved proto chunks did not. When vanilla or Paper finish such a proto chunk, they log "Skipping block entity with invalid type" and drop the data. So suspicious sand and gravel at the edge of a pre-generated area (desert wells, desert pyramids, ocean ruins, trail ruins) lost their archaeology loot once the chunk was finished outside Horizon. What changes: - `VanillaTerrain`'s proto save writes each pending block entity with the `id` of its block. - It uses `lan::chunks::block_entity_type`, which already maps for example `suspicious_sand` to `brushable_block`. ## Vanilla reference - `ProtoChunk.getBlockEntityNbtForSaving` / `BlockEntity.saveWithFullMetadata`: every pending block entity is saved with its type. - `BlockEntity.loadStatic`: the "Skipping block entity with invalid type" path. ## Tests - New integration test `tests/generation_saves.rs::saved_proto_block_entities_keep_their_id`. It generates and saves the proto chunks around a cold ocean ruin of seed 12345 and checks that every saved block entity has an `id`, including the ruin's suspicious gravel with its `archaeology/` loot table. - `tools/test_block_entity_storage_parity.py` passed on this branch: 78,251 lines match on client and server. - End to end: All fixes of this series (the five save PRs and the four structure-start PRs) merged onto `main` and run as a dedicated server, which pre-generated seed 12345, 4,096 chunks per dimension (radius 500 blocks), and the result was compared chunk by chunk with the same area from the pinned vanilla 26.3 server (`compare.py`, our own world-diff tool). Then the world was opened in Paper 26.3. Paper's log shows no exception and no skipped block entity. None of the 528 proto chunks per dimension holds a block entity without an `id`. ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on d2a09df18e70, against upstream/main at 57c5f8129, 3 min 32 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +75 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (6 s) | | clippy | ✅ (25 s) | | tests: horizon-client | ✅ 1296 passed (2 min 58 s) | | doc tests | ✅ 0 passed (2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 324 affected, to run in CI (--quick): arrow, attribute_map_queries, auto_jump, biome_source_codec, biome_temperature, biome_weather, biome_zoom, block_blob, block_collision_scan, block_column, block_entity_anim, block_entity_render and 312 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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 04:13:45 +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#3980
No description provided.