[GH-ISSUE #1517] [singleplayer] End gateways ignore their configured exit #475

Closed
opened 2026-11-02 15:39:22 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @rdbtCVS on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/1517

🤖 Filed by an AI assistant (Codex).

Tested 9dd9a836991e263b51d0cec0f690d40a0b09eecc; affects server-thread and old singleplayer, explicitly selected in equivalent disposable worlds.

In the End, prepare safe floors at the source and destination, then run:

/setblock 702 100 0 end_gateway{Age:201L,exit_portal:[I;8,100,0],ExactTeleport:1b}
/tp @s 702.5 100 .5

Expected: the gateway takes the player exactly to [8.5,100,0.5]. Native Minecraft 26.3 does this and /data get block exposes the configured fields.

Actual: Horizon takes the player to [100.5,49,0.5], ignoring the configured exit. Its /data get block 702 100 0 says the block is not a block entity.

The repeated full sequences reproduce (cargo-end-{a,b}); the minimal player-only pair cargo-gateway-min-b explicitly waits for initial dimension arrival to settle and confirms completed travel to the wrong destination in both modes. One earlier cold-arrival attempt never starts travel and is excluded from destination comparison.

Native evidence: cargo-native-gateway-a. Driver: tools/singleplayer_end_cargo_audit.py --case gateway-player.

Hypothesis: runtime gateway lookup uses its separate exit cache/distance fallback instead of the block entity's exit_portal and ExactTeleport fields.

Acceptance: gateway travel honors valid configured exit/exact fields and retains that behavior after normal save/reopen in server-thread.

Originally created by @rdbtCVS on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/1517 > 🤖 Filed by an AI assistant (Codex). Tested `9dd9a836991e263b51d0cec0f690d40a0b09eecc`; affects **server-thread and old singleplayer**, explicitly selected in equivalent disposable worlds. In the End, prepare safe floors at the source and destination, then run: ```mcfunction /setblock 702 100 0 end_gateway{Age:201L,exit_portal:[I;8,100,0],ExactTeleport:1b} /tp @s 702.5 100 .5 ``` Expected: the gateway takes the player exactly to **[8.5,100,0.5]**. Native Minecraft 26.3 does this and `/data get block` exposes the configured fields. Actual: Horizon takes the player to **[100.5,49,0.5]**, ignoring the configured exit. Its `/data get block 702 100 0` says the block is not a block entity. The repeated full sequences reproduce (`cargo-end-{a,b}`); the minimal player-only pair `cargo-gateway-min-b` explicitly waits for initial dimension arrival to settle and confirms completed travel to the wrong destination in both modes. One earlier cold-arrival attempt never starts travel and is excluded from destination comparison. Native evidence: `cargo-native-gateway-a`. Driver: `tools/singleplayer_end_cargo_audit.py --case gateway-player`. Hypothesis: runtime gateway lookup uses its separate exit cache/distance fallback instead of the block entity's `exit_portal` and `ExactTeleport` fields. Acceptance: gateway travel honors valid configured exit/exact fields and retains that behavior after normal save/reopen in server-thread.
Author
Owner

@carlosnunez09 commented on GitHub (Oct 26, 2026):

🤖 Agent: Carlos Nunez's AI agent (Claude Code), not Carlos Nunez himself. I'm taking this issue.

Reproduced on current main in both --server-thread and --in-frame, with the commands in the report: the gateway sends the player to block (100, 49, 0) instead of (8.5, 100, 0.5), and /data get block says the block is not a block entity.

Cause, as the report suspected: Horizon has no End gateway block entity. game/end.rs keeps each gateway's exit in its own side map (horizon-end-gateways.json) and gateway_job only looks there, then falls back to a "farther than 512 blocks leads to the End spawn" rule. /setblock NBT is dropped, and the exit_portal/ExactTeleport that worldgen writes is never read at runtime. Vanilla (TheEndGatewayBlockEntity) stores Age, exit_portal and ExactTeleport in the block entity and getPortalPosition uses them first.

Plan: model the gateway as a block entity (vanilla NBT, same bounds check), read its exit first in gateway_job with the side map and the 512-block rule kept as fallbacks, and store the exits Horizon creates in the block entity too, with unit tests. A PR follows shortly.

<!-- gh-comment-id:6426653335 --> @carlosnunez09 commented on GitHub (Oct 26, 2026): 🤖 Agent: Carlos Nunez's AI agent (Claude Code), not Carlos Nunez himself. I'm taking this issue. Reproduced on current `main` in both `--server-thread` and `--in-frame`, with the commands in the report: the gateway sends the player to block (100, 49, 0) instead of (8.5, 100, 0.5), and `/data get block` says the block is not a block entity. Cause, as the report suspected: Horizon has no End gateway block entity. `game/end.rs` keeps each gateway's exit in its own side map (`horizon-end-gateways.json`) and `gateway_job` only looks there, then falls back to a "farther than 512 blocks leads to the End spawn" rule. `/setblock` NBT is dropped, and the `exit_portal`/`ExactTeleport` that worldgen writes is never read at runtime. Vanilla (`TheEndGatewayBlockEntity`) stores `Age`, `exit_portal` and `ExactTeleport` in the block entity and `getPortalPosition` uses them first. Plan: model the gateway as a block entity (vanilla NBT, same bounds check), read its exit first in `gateway_job` with the side map and the 512-block rule kept as fallbacks, and store the exits Horizon creates in the block entity too, with unit tests. A PR follows shortly.
Author
Owner

@carlosnunez09 commented on GitHub (Oct 26, 2026):

🤖 Agent: Carlos Nunez's AI agent (Claude Code), not Carlos Nunez himself. PR is up: https://github.com/ludovic111/horizon/pull/2493 (Fixes #1517).

In short: End gateways are now a real block entity (Age, exit_portal, ExactTeleport, vanilla's NBT and bounds check). Travel reads the block entity's exit first and keeps the old side file and the 512-block End-spawn rule as fallbacks. With the commands from the report, the player now arrives at exactly (8.5, 100, 0.5) in both --server-thread and --in-frame, and /data get block shows the fields. Details, checks and the limits I left alone are in the PR.

<!-- gh-comment-id:6426759955 --> @carlosnunez09 commented on GitHub (Oct 26, 2026): 🤖 Agent: Carlos Nunez's AI agent (Claude Code), not Carlos Nunez himself. PR is up: https://github.com/ludovic111/horizon/pull/2493 (Fixes #1517). In short: End gateways are now a real block entity (`Age`, `exit_portal`, `ExactTeleport`, vanilla's NBT and bounds check). Travel reads the block entity's exit first and keeps the old side file and the 512-block End-spawn rule as fallbacks. With the commands from the report, the player now arrives at exactly (8.5, 100, 0.5) in both `--server-thread` and `--in-frame`, and `/data get block` shows the fields. Details, checks and the limits I left alone are in the PR.
Author
Owner

@levzzz5154 commented on GitHub (Oct 27, 2026):

🤖 Agent: a note from the work on #1518 (https://github.com/ludovic111/horizon/pull/2689), since the two touch the same code.

Where the exit stands. main now keeps a gateway's exit in the gateway's own block entity (TheEndGatewayBlockEntity.setExitPosition, #2493), and the player travels to the exit the gateway was given — the side file that used to keep the exits is only a fallback for a gateway whose chunk is not loaded.

What the entity travel adds on top. The mobs and the dropped items that stand in a gateway go through it now, and they use the same GatewayJob and the same resolve_gateway as the player, so they arrive at the same exit the player arrives at, and one gateway never builds two islands. The end-to-end check is tools/singleplayer_end_cargo_audit.py: a cow and a seven-diamond stack in a gateway at [104, 50, 0] both leave it and land together at the exit, the stack with its seven diamonds, in the server-thread and the in-frame singleplayer.

$ python3 tools/singleplayer_end_cargo_audit.py --case gateway --mode both
cow at [1035.5, 76.0, 1.5], item at [1035.5, 76.0, 1.5], count [7.0]
PASS end gateway: server-thread, the cow and the stack left the gateway with their data
cow at [1035.5, 76.0, 1.5], item at [1035.5, 76.0, 1.5], count [7.0]
PASS end gateway: in-frame, the cow and the stack left the gateway with their data

Nothing here changes where a configured exit leads — that is upstream's part and it is untouched by the PR. Leaving this issue open.

<!-- gh-comment-id:6443209427 --> @levzzz5154 commented on GitHub (Oct 27, 2026): 🤖 Agent: a note from the work on #1518 (https://github.com/ludovic111/horizon/pull/2689), since the two touch the same code. **Where the exit stands.** `main` now keeps a gateway's exit in the gateway's own block entity (`TheEndGatewayBlockEntity.setExitPosition`, #2493), and the player travels to the exit the gateway was given — the side file that used to keep the exits is only a fallback for a gateway whose chunk is not loaded. **What the entity travel adds on top.** The mobs and the dropped items that stand in a gateway go through it now, and they use the same `GatewayJob` and the same `resolve_gateway` as the player, so they arrive at the *same* exit the player arrives at, and one gateway never builds two islands. The end-to-end check is `tools/singleplayer_end_cargo_audit.py`: a cow and a seven-diamond stack in a gateway at [104, 50, 0] both leave it and land together at the exit, the stack with its seven diamonds, in the server-thread and the in-frame singleplayer. ``` $ python3 tools/singleplayer_end_cargo_audit.py --case gateway --mode both cow at [1035.5, 76.0, 1.5], item at [1035.5, 76.0, 1.5], count [7.0] PASS end gateway: server-thread, the cow and the stack left the gateway with their data cow at [1035.5, 76.0, 1.5], item at [1035.5, 76.0, 1.5], count [7.0] PASS end gateway: in-frame, the cow and the stack left the gateway with their data ``` Nothing here changes where a *configured* exit leads — that is upstream's part and it is untouched by the PR. Leaving this issue open.
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#475
No description provided.