[PR #5139] [MERGED] Store End gateway exits only in block entity NBT #6098

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5139
Author: @oskal675-design
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: fix/gateway-exit-storage


📝 Commits (5)

  • 12af64a Keep End gateway exits only in block entity NBT
  • f3a8781 Merge origin/main into fix/gateway-exit-storage
  • 85b378f End gateway migration: a side file it can't read no longer stops the End from opening
  • 7fddcb2 Merge origin/main (with #5251's build fix)
  • dc8ec33 Merge remote-tracking branch 'origin/main' into sweep/5139-m3

📊 Changes

5 files changed (+322 additions, -129 deletions)

View changed files

📝 crates/horizon-client/src/game/end.rs (+69 -129)
📝 crates/horizon-client/src/game/server_travel.rs (+11 -0)
📝 crates/horizon-client/src/game/world_loading.rs (+7 -0)
📝 crates/horizon-client/src/save.rs (+2 -0)
➕ crates/horizon-client/src/save/gateway.rs (+233 -0)

📄 Description

🤖 Opened by oskal675-design's AI agent (Codex, GPT-6.1), not by oskal675-design personally.

What and why

Fixes #4429.

End gateway exits now live only in their block entity NBT. Remove the runtime JSON map and writer, and keep the source chunk loaded while an asynchronous teleport finds and saves a new exit.

Before End chunk readers start, migrate existing horizon-end-gateways.json entries into real gateway blocks. Existing valid NBT wins; removed gateways and missing chunks do not gain stale block entities. Preserve unrelated chunk tags and delete the legacy file only after the region writer confirms success. Malformed data or write failures retain the file and return an error so loading cannot silently discard exits.

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

Minecraft Java 26.3 TheEndGatewayBlockEntity.saveAdditional / loadAdditional store exit_portal and ExactTeleport in block entity NBT. getPortalPosition / setExitPosition update that block entity and mark it changed. Checked the actual client jar bytecode. The legacy-file migration is Horizon-only; retaining source chunks accommodates Horizon's asynchronous destination loading.

tools/test_end_gateway_parity.py: 5,820 fixtures; 754,877 output lines match Rust for the vanilla client and another 754,877 for the server.

tools/port_ledger.py check --base origin/main was run. Its callee/uncited-function advisories include the asynchronous split of gateway resolution and Horizon-only migration. The setChanged equivalent is world.modified.insert(chunk) in set_gateway_exit.

Other projects' code

none

Self-check

Real integrated-server before/after proof on a scratch world:

  • Baseline: a legacy JSON exit is absent from the gateway's NBT before use.
  • Fixed build, same saved world: exit [104,80,0] is present before use, the JSON is gone, and teleporting uses that exit.
  • Remove and replace the gateway: the old exit does not return. Teleporting generates a new exit [1099,85,-3]; after quitting completely and reopening, the same exit remains in NBT and no JSON is recreated.

Migration tests cover NBT precedence, unrelated tag preservation, stale entries, idempotence, malformed JSON, and an injected writer failure retaining the legacy file. Targeted migration tests (2) and gateway bin tests (4) pass.

The quick self-check ran offline in an isolated network namespace (the host proxy otherwise intercepts the protocol test's TEST-NET address). Temporary files were bound to /tmp for existing git-temp tests; all files stayed inside the project. The targeted vanilla harness above ran separately; the full affected harness set remains for CI.

pr_ready (tools/pr_ready.py --quick on omarchy, against origin/main at 36f4bc00d, 3 min 5 s)

Check Result
Scope ✅ 5 files, +319 −129
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 495 passed (20 s)
rustfmt ✅ (5 s)
clippy ✅ (19 s)
tests: horizon-client ✅ 1341 passed (2 min 17 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 313 affected, to run in CI (--quick): arrow, block_removal, block_survival, bundle_weight, camera, canyon_carver, carving_geometry, carving_mask, cauldron, cave_carver, chat_screen, chest_pair and 301 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Codex.


🔄 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/5139 **Author:** [@oskal675-design](https://github.com/oskal675-design) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/gateway-exit-storage` --- ### 📝 Commits (5) - [`12af64a`](https://github.com/horizon-rust/horizon/commit/12af64aab1bb57e408a5836a772d9853c4ee3c43) Keep End gateway exits only in block entity NBT - [`f3a8781`](https://github.com/horizon-rust/horizon/commit/f3a8781d9b59263486fd5d71d3cbddc6fbceca41) Merge origin/main into fix/gateway-exit-storage - [`85b378f`](https://github.com/horizon-rust/horizon/commit/85b378f22715f4f8a243254045d28fc35c85bd4a) End gateway migration: a side file it can't read no longer stops the End from opening - [`7fddcb2`](https://github.com/horizon-rust/horizon/commit/7fddcb2ec5487174bc4741e538306a7f86aa0469) Merge origin/main (with #5251's build fix) - [`dc8ec33`](https://github.com/horizon-rust/horizon/commit/dc8ec335762dd1eeec9313021606c9f81bfb89ea) Merge remote-tracking branch 'origin/main' into sweep/5139-m3 ### 📊 Changes **5 files changed** (+322 additions, -129 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/end.rs` (+69 -129) 📝 `crates/horizon-client/src/game/server_travel.rs` (+11 -0) 📝 `crates/horizon-client/src/game/world_loading.rs` (+7 -0) 📝 `crates/horizon-client/src/save.rs` (+2 -0) ➕ `crates/horizon-client/src/save/gateway.rs` (+233 -0) </details> ### 📄 Description > 🤖 Opened by oskal675-design's AI agent (Codex, GPT-6.1), not by oskal675-design personally. ## What and why Fixes #4429. End gateway exits now live only in their block entity NBT. Remove the runtime JSON map and writer, and keep the source chunk loaded while an asynchronous teleport finds and saves a new exit. Before End chunk readers start, migrate existing `horizon-end-gateways.json` entries into real gateway blocks. Existing valid NBT wins; removed gateways and missing chunks do not gain stale block entities. Preserve unrelated chunk tags and delete the legacy file only after the region writer confirms success. Malformed data or write failures retain the file and return an error so loading cannot silently discard exits. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference Minecraft Java 26.3 `TheEndGatewayBlockEntity.saveAdditional` / `loadAdditional` store `exit_portal` and `ExactTeleport` in block entity NBT. `getPortalPosition` / `setExitPosition` update that block entity and mark it changed. Checked the actual client jar bytecode. The legacy-file migration is Horizon-only; retaining source chunks accommodates Horizon's asynchronous destination loading. `tools/test_end_gateway_parity.py`: 5,820 fixtures; 754,877 output lines match Rust for the vanilla client and another 754,877 for the server. `tools/port_ledger.py check --base origin/main` was run. Its callee/uncited-function advisories include the asynchronous split of gateway resolution and Horizon-only migration. The `setChanged` equivalent is `world.modified.insert(chunk)` in `set_gateway_exit`. ## Other projects' code none ## Self-check Real integrated-server before/after proof on a scratch world: - Baseline: a legacy JSON exit is absent from the gateway's NBT before use. - Fixed build, same saved world: exit `[104,80,0]` is present before use, the JSON is gone, and teleporting uses that exit. - Remove and replace the gateway: the old exit does not return. Teleporting generates a new exit `[1099,85,-3]`; after quitting completely and reopening, the same exit remains in NBT and no JSON is recreated. Migration tests cover NBT precedence, unrelated tag preservation, stale entries, idempotence, malformed JSON, and an injected writer failure retaining the legacy file. Targeted migration tests (2) and gateway bin tests (4) pass. The quick self-check ran offline in an isolated network namespace (the host proxy otherwise intercepts the protocol test's TEST-NET address). Temporary files were bound to `/tmp` for existing git-temp tests; all files stayed inside the project. The targeted vanilla harness above ran separately; the full affected harness set remains for CI. **pr_ready** (`tools/pr_ready.py --quick` on omarchy, against origin/main at 36f4bc00d, 3 min 5 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +319 −129 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 495 passed (20 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (19 s) | | tests: horizon-client | ✅ 1341 passed (2 min 17 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 313 affected, to run in CI (--quick): arrow, block_removal, block_survival, bundle_weight, camera, canyon_carver, carving_geometry, carving_mask, cauldron, cave_carver, chat_screen, chest_pair and 301 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Codex](https://openai.com/codex/). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:11:38 +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#6098
No description provided.