[PR #2634] [MERGED] Send items and mobs through End portals #4492

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

📋 Pull Request Information

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

Base: main ← Head: claude/1515-end-portal-entities-643979


📝 Commits (2)

  • dfb28e4 Send items and mobs through End portals
  • 21fd3a6 Turn End portal travellers as their teleport does

📊 Changes

2 files changed (+296 additions, -92 deletions)

View changed files

📝 crates/horizon-client/src/game/end.rs (+1 -1)
📝 crates/horizon-client/src/game/nether_portal.rs (+295 -91)

📄 Description

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

Fixes #1515.

What changed

Mobs, dropped items and empty boats and minecarts could go through Nether portals but not End portals: find_entity_portals (in game/nether_portal.rs) only looked for nether_portal blocks. This PR adds End portals to that same path. There is no second copy of the machinery.

  • Detection (EndPortalBlock.entityInside, Entity.checkInsideBlocks / collidedWithShapeMovingFrom): the swept check now also stops at an end_portal block when the entity's box, moving from its last position to its new one, meets the portal's entity-inside shape (y 6/16..12/16, the shape the player code in game/end.rs already uses). An item falling through the slab counts. An item lying on the floor below it does not. The per-chunk palette pre-check (may_hold_portal) also accepts End portal states.
  • Eligibility, cooldown, timing: these are unchanged and shared with Nether portals. That covers mob_can_use_portal (no passengers, no Wither), empty vehicles only, transition time 0 for non-players, and the 300-tick PortalCooldown on arrival.
  • Destination (EndPortalBlock.getPortalDestination for non-players): send_through_portal picks an End plan when the entry block is an End portal.
    • Into the End: END_SPAWN_POINT's bottom centre (100.5, 50, 0.5). The obsidian platform below it is rebuilt with the player's EndPlatformFeature.createEndPlatform code (end_arrival), and the entity faces west.
    • Out of the End: the top of the Overworld shared spawn's MOTION_BLOCKING_NO_LEAVES column (Entity.adjustSpawnLocation). The yaw and pitch turn by the world spawn's angles (Relative.ROTATION with respawnData.yaw() / pitch()).
    • In both cases the motion is kept (Relative.DELTA), and the pitch is clamped to ±90 (PositionMoveRotation.calculateAbsolute).
  • Waiting arrivals: these work the same way as Nether ones. The entity is saved and removed, then joins the destination level once its area is loaded. That happens on the default server thread (the End level ticks once a player is there), in-frame, and for LAN and dedicated servers. horizon_portal_arrivals.dat now stores an end flag. Its dimension is read with Dim::from_id, because the old reader turned the_end into the Overworld. Files saved before this change still load as Nether plans.
  • END_SPAWN in game/end.rs is now pub(super).

Checked against vanilla 26.3

Followed with the decompiled 26.3 sources (lab.py prepare from my own install, then decompile: no missing files, no decompiler error markers):

  • EndPortalBlock.entityInside, getEntityInsideCollisionShape (Block.column(16, 6, 12), y 6/16..12/16) and getPortalDestination.
  • Entity.setAsInsidePortal, handlePortal, canUsePortal, getDimensionChangingDelay (300), collidedWithShapeMovingFrom and adjustSpawnLocation.
  • PositionMoveRotation.calculateAbsolute and Entity.teleportSetPosition.

The second commit fixes what this check found: leaving the End, vanilla turns the entity by the respawn data's yaw and pitch (Relative.ROTATION) instead of keeping its rotation.

Remaining differences from vanilla:

  • Out of the End, vanilla goes to respawnData.dimension(). Horizon always saves the world spawn in the Overworld, so this PR sends entities to the Overworld.
  • Vanilla places a portal ticket and lands the entity at once. Here it waits, as Nether-portal arrivals already do, until a player has the destination loaded.
  • Vanilla's platform is built with dropBlocks = true. The platform code shared with the player doesn't drop the blocks it replaces.
  • The Overworld landing height uses motion_top (creatures.rs), which approximates MOTION_BLOCKING with full collision or fluid.

Tests

New unit tests in game/nether_portal.rs:

  • End plans lead to the End spawn from the Overworld or the Nether, and to the world spawn from the End.
  • The entity-inside shape catches a falling item, a one-tick fall across the whole slab and a standing cow. It doesn't catch an item resting below or above the slab, or a cow beside the portal.
  • The rotation follows calculateAbsolute: facing west into the End, turned by the spawn's angles out of it, pitch clamped.
  • Arrivals round-trip through the save format with their End plan, and an old entry with no end flag loads as a Nether plan.

In the game (target/fast build, offscreen, fresh scratch homes; both the server thread and --in-frame):

  • Into the End (the issue's case): stone floor at y=99, end_portal at (0, 100, 3) and (6, 100, 3), summon cow 0.5 100 3.5 {NoAI:1b,PersistenceRequired:1b,CustomName:"Bessie"} and a 7-diamond item stack at (6.5, 100.6, 3.5).
    • Bessie leaves the Overworld within 2 ticks.
    • The player follows through an End portal of his own. Exactly one Bessie is on the rebuilt obsidian platform at (100.5, 50, 0.5), with NoAI, her name, PersistenceRequired, Rotation [90, 0] and PortalCooldown 300.
    • The 7 diamonds arrive beside the player, who picks them up: 7 in the inventory.
  • Out of the End: an end_portal at (102, 49, 0) and a pig {NoAI:1b,PersistenceRequired:1b,CustomName:"Wilbur",Rotation:[30f,10f]} in it.
    • Back in the Overworld, exactly one Wilbur stands at the spawn column (−31.5, 65, 0.5), with Rotation [30, 10] (this world's spawn angles are 0) and PortalCooldown 300.

Parity harnesses, run locally with the prepared .local/:

  • Portal and entity harnesses: nether_portal, end_gateway, end_podium, forced_end, player_travel, server_dimension_players, server_entities and server_dragon pass.
  • The whole --changed origin/main set: 350 harnesses depend on these two files, and 346 pass. Four don't, none for a reason in this change:
    • save_roundtrip, spawn_loot and world_reopen need the vscreen virtual screen, which this machine doesn't have.
    • entity_model compares cleanly ("0 layers differ from vanilla") but fails on an oracle error: IllegalAccessException setting a final field of Bat by reflection. The oracle ran on JDK 27, and the lock pins Java 25.

pr_ready --quick on the head:

pr_ready (tools/pr_ready.py --quick on cachyos, against origin/main at 51447edda, 2 min 9 s)

Check Result
Scope ✅ 2 files, +296 −92
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 325 passed (17 s)
rustfmt ✅ (4 s)
clippy ✅ (5 s)
tests: horizon-client ✅ 1291 passed (1 min 39 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 ➖ 31 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, forced_end, friends_integration, hardcore_respawn, lan_integration, locator_bar and 19 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

lan_e2e --check portals passes: two games, the host on its server thread. It covers the players' portal path next to this one. The guest arrives in the Nether at (−10, 72, −4), the host on the End platform at (100, 49, 0), the credits show, and the trip back lands at (7.5, 65, 3.5).

Not run: tools/singleplayer_end_cargo_audit.py, the issue's driver, which isn't in the repository. The in-game script above replays its cases.

🤖 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/2634 **Author:** [@ASOwnerYT](https://github.com/ASOwnerYT) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `claude/1515-end-portal-entities-643979` --- ### 📝 Commits (2) - [`dfb28e4`](https://github.com/horizon-rust/horizon/commit/dfb28e42d0008f2f2cc775dfcb99e3200b734d1c) Send items and mobs through End portals - [`21fd3a6`](https://github.com/horizon-rust/horizon/commit/21fd3a6b064c121c058e1d80fb26b1473cd3aa69) Turn End portal travellers as their teleport does ### 📊 Changes **2 files changed** (+296 additions, -92 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/end.rs` (+1 -1) 📝 `crates/horizon-client/src/game/nether_portal.rs` (+295 -91) </details> ### 📄 Description > 🤖 Opened by asowneryt's AI agent (Claude Code), not by asowneryt himself. Fixes #1515. ## What changed Mobs, dropped items and empty boats and minecarts could go through Nether portals but not End portals: `find_entity_portals` (in `game/nether_portal.rs`) only looked for `nether_portal` blocks. This PR adds End portals to that same path. There is no second copy of the machinery. - **Detection** (`EndPortalBlock.entityInside`, `Entity.checkInsideBlocks` / `collidedWithShapeMovingFrom`): the swept check now also stops at an `end_portal` block when the entity's box, moving from its last position to its new one, meets the portal's entity-inside shape (y 6/16..12/16, the shape the player code in `game/end.rs` already uses). An item falling through the slab counts. An item lying on the floor below it does not. The per-chunk palette pre-check (`may_hold_portal`) also accepts End portal states. - **Eligibility, cooldown, timing:** these are unchanged and shared with Nether portals. That covers `mob_can_use_portal` (no passengers, no Wither), empty vehicles only, transition time 0 for non-players, and the 300-tick `PortalCooldown` on arrival. - **Destination** (`EndPortalBlock.getPortalDestination` for non-players): `send_through_portal` picks an End plan when the entry block is an End portal. - Into the End: `END_SPAWN_POINT`'s bottom centre (100.5, 50, 0.5). The obsidian platform below it is rebuilt with the player's `EndPlatformFeature.createEndPlatform` code (`end_arrival`), and the entity faces west. - Out of the End: the top of the Overworld shared spawn's `MOTION_BLOCKING_NO_LEAVES` column (`Entity.adjustSpawnLocation`). The yaw and pitch turn by the world spawn's angles (`Relative.ROTATION` with `respawnData.yaw()` / `pitch()`). - In both cases the motion is kept (`Relative.DELTA`), and the pitch is clamped to ±90 (`PositionMoveRotation.calculateAbsolute`). - **Waiting arrivals:** these work the same way as Nether ones. The entity is saved and removed, then joins the destination level once its area is loaded. That happens on the default server thread (the End level ticks once a player is there), in-frame, and for LAN and dedicated servers. `horizon_portal_arrivals.dat` now stores an `end` flag. Its dimension is read with `Dim::from_id`, because the old reader turned `the_end` into the Overworld. Files saved before this change still load as Nether plans. - `END_SPAWN` in `game/end.rs` is now `pub(super)`. ## Checked against vanilla 26.3 Followed with the decompiled 26.3 sources (`lab.py prepare` from my own install, then `decompile`: no missing files, no decompiler error markers): - `EndPortalBlock.entityInside`, `getEntityInsideCollisionShape` (`Block.column(16, 6, 12)`, y 6/16..12/16) and `getPortalDestination`. - `Entity.setAsInsidePortal`, `handlePortal`, `canUsePortal`, `getDimensionChangingDelay` (300), `collidedWithShapeMovingFrom` and `adjustSpawnLocation`. - `PositionMoveRotation.calculateAbsolute` and `Entity.teleportSetPosition`. The second commit fixes what this check found: leaving the End, vanilla turns the entity by the respawn data's yaw and pitch (`Relative.ROTATION`) instead of keeping its rotation. Remaining differences from vanilla: - Out of the End, vanilla goes to `respawnData.dimension()`. Horizon always saves the world spawn in the Overworld, so this PR sends entities to the Overworld. - Vanilla places a portal ticket and lands the entity at once. Here it waits, as Nether-portal arrivals already do, until a player has the destination loaded. - Vanilla's platform is built with `dropBlocks = true`. The platform code shared with the player doesn't drop the blocks it replaces. - The Overworld landing height uses `motion_top` (`creatures.rs`), which approximates `MOTION_BLOCKING` with full collision or fluid. ## Tests New unit tests in `game/nether_portal.rs`: - End plans lead to the End spawn from the Overworld or the Nether, and to the world spawn from the End. - The entity-inside shape catches a falling item, a one-tick fall across the whole slab and a standing cow. It doesn't catch an item resting below or above the slab, or a cow beside the portal. - The rotation follows `calculateAbsolute`: facing west into the End, turned by the spawn's angles out of it, pitch clamped. - Arrivals round-trip through the save format with their End plan, and an old entry with no `end` flag loads as a Nether plan. **In the game** (`target/fast` build, offscreen, fresh scratch homes; both the server thread and `--in-frame`): - **Into the End (the issue's case):** stone floor at y=99, `end_portal` at (0, 100, 3) and (6, 100, 3), `summon cow 0.5 100 3.5 {NoAI:1b,PersistenceRequired:1b,CustomName:"Bessie"}` and a 7-diamond item stack at (6.5, 100.6, 3.5). - Bessie leaves the Overworld within 2 ticks. - The player follows through an End portal of his own. Exactly one Bessie is on the rebuilt obsidian platform at (100.5, 50, 0.5), with `NoAI`, her name, `PersistenceRequired`, `Rotation [90, 0]` and `PortalCooldown 300`. - The 7 diamonds arrive beside the player, who picks them up: 7 in the inventory. - **Out of the End:** an `end_portal` at (102, 49, 0) and a pig `{NoAI:1b,PersistenceRequired:1b,CustomName:"Wilbur",Rotation:[30f,10f]}` in it. - Back in the Overworld, exactly one Wilbur stands at the spawn column (−31.5, 65, 0.5), with `Rotation [30, 10]` (this world's spawn angles are 0) and `PortalCooldown 300`. **Parity harnesses**, run locally with the prepared `.local/`: - Portal and entity harnesses: `nether_portal`, `end_gateway`, `end_podium`, `forced_end`, `player_travel`, `server_dimension_players`, `server_entities` and `server_dragon` pass. - The whole `--changed origin/main` set: 350 harnesses depend on these two files, and 346 pass. Four don't, none for a reason in this change: - `save_roundtrip`, `spawn_loot` and `world_reopen` need the `vscreen` virtual screen, which this machine doesn't have. - `entity_model` compares cleanly ("0 layers differ from vanilla") but fails on an oracle error: `IllegalAccessException` setting a final field of `Bat` by reflection. The oracle ran on JDK 27, and the lock pins Java 25. `pr_ready --quick` on the head: **pr_ready** (`tools/pr_ready.py --quick` on cachyos, against origin/main at 51447edda, 2 min 9 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +296 −92 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 325 passed (17 s) | | rustfmt | ✅ (4 s) | | clippy | ✅ (5 s) | | tests: horizon-client | ✅ 1291 passed (1 min 39 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 | ➖ 31 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, forced_end, friends_integration, hardcore_respawn, lan_integration, locator_bar and 19 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | `lan_e2e --check portals` passes: two games, the host on its server thread. It covers the players' portal path next to this one. The guest arrives in the Nether at (−10, 72, −4), the host on the End platform at (100, 49, 0), the credits show, and the trip back lands at (7.5, 65, 3.5). Not run: `tools/singleplayer_end_cargo_audit.py`, the issue's driver, which isn't in the repository. The in-game script above replays its cases. 🤖 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:17:34 +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#4492
No description provided.