[PR #4262] [MERGED] Ender pearls go through End gateways #5527

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4262
Author: @d3grando
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @levzzz5154

Base: main ← Head: fix-3514-pearl-gateway


📝 Commits (1)

  • 95d9303 Ender pearls go through End gateways

📊 Changes

2 files changed (+254 additions, -48 deletions)

View changed files

📝 crates/horizon-client/src/end_gateway.rs (+99 -0)
📝 crates/horizon-client/src/game/end.rs (+155 -48)

📄 Description

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

What and why

Part of #3514 (the ThrownEnderpearl.onInsideBlock row).

A thrown ender pearl flew straight through an End gateway and fell into the void, so the usual trick of pearling into a gateway to reach the outer islands did nothing. The cause: find_end_gateway_portals and handle_end_gateway_portals (game/end.rs) only collected dropped items and mobs, never projectiles. In vanilla every entity can use a gateway, and the pearl gets special handling.

The fix, on the server side (server thread, LAN host, dedicated server):

  • Thrown ender pearls now go through the same gateway pass as items and mobs. A pearl whose move this tick swept through a gateway block (end_gateway::pearl_gateway, the 0.25 box from previous to position) is taken in by EndGatewayBlock.entityInside. The gateway's own 40-tick cooldown still applies, and the pearl's Traveller keeps its 300-tick portal cooldown.
  • On the next tick, before it moves again (Entity.handlePortal), the pearl is moved to the gateway's exit with no motion and rotation 0 (EndGatewayBlock.getPortalDestination builds a TeleportTransition with Vec3.ZERO, 0, 0 and no relative flags for a ThrownEnderpearl). It then falls from there and, as before, takes its owner to the spot where it lands. While the exit's chunk is still loading, the pearl waits in the same arrivals queue the items and mobs use. That queue now holds either a saved compound or a pearl, because projectiles are not saved.
  • ThrownEnderpearl.teleport calls placePortalTicket, so the chunk the pearl comes out in stays loaded for TicketType.PORTAL's 300 ticks. Without that, a pearl coming out ~1000 blocks from its owner would fall through an unloaded chunk.
  • ThrownEnderpearl.onInsideBlock fires the owner's ServerPlayer.onInsideBlock, the enter_block trigger, for the gateway. For a guest's pearl it runs through as_guest. This is how vanilla grants Remote Getaway when a player pearls through a gateway.

One difference from vanilla remains. In vanilla the pearl goes through in the same tick, because ThrowableProjectile.tick runs applyEffectsFromBlocks and then Projectile.tick (baseTick, handlePortal). Here it goes through on the next tick, before it moves, the way items and mobs already do in this pass. Its exit and its fall are the same, one tick later.

Only pearls are covered. Vanilla also lets other projectiles (arrows, snowballs, and so on) through a gateway, keeping their velocity. That is a separate gap and is not in this row.

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

Read with javap -c -p on the 26.3 jar:

  • ThrownEnderpearl.onInsideBlock(BlockState): on Blocks.END_GATEWAY with a ServerPlayer owner, calls owner.onInsideBlock(state) (the enter_block trigger).
  • EndGatewayBlock.entityInside: if canUsePortal(false) and the gateway is not cooling down, setAsInsidePortal then TheEndGatewayBlockEntity.triggerCooldown.
  • EndGatewayBlock.getPortalDestination: for an instanceof ThrownEnderpearl, new TeleportTransition(level, pos, Vec3.ZERO, 0, 0, Set.of(), PLACE_PORTAL_TICKET). Other entities keep Relative.DELTA and Relative.ROTATION.
  • ThrownEnderpearl.teleport, Entity.placePortalTicket (TicketType.PORTAL, radius 3) and TicketType.PORTAL (timeout 300).

No parity harness covers End gateway travel. The new unit tests in end_gateway.rs check the pearl part: a pearl thrown east is found in the gateway's block, goes through on the next tick, sits at the exit with no motion and rotation 0, falls straight down from it, and keeps its portal cooldown. A pearl flying over the gateway, and a snowball on the same path, are not taken in.

Self-check

tools/pr_ready.py does not run on Windows (it needs SIGHUP), so the steps were run by hand:

  • cargo fmt --all -- --check: clean
  • cargo clippy -p horizon-client --all-targets -- -D warnings: clean (Finished, no warnings)
  • cargo test --profile fast -p horizon-client --lib end_gateway::
    • before (the game/end.rs and end_gateway.rs code reverted, tests kept): does not compile, error[E0425]: cannot find function pearl_gateway / place_pearl
    • before, with pearl_gateway returning None and place_pearl doing nothing (the old behaviour, so the test compiles): a_thrown_pearl_goes_through_the_gateway_and_falls_from_its_exit ... FAILED, left: None, right: Some(BlockPos { x: 702, y: 100, z: 0 }), test result: FAILED. 7 passed; 1 failed
    • after: test result: ok. 8 passed; 0 failed
  • cargo test --profile fast -p horizon-client --bin horizon-client end::: test result: ok. 3 passed; 0 failed (the existing gateway exit tests)
  • In game, single player on the server thread (Windows, --profile fast). The window's player is a hub guest of the server thread there, the same path a LAN guest takes. Setup in the End: a platform at y 80 around (100, 100), an end_gateway{exit_portal:[I;100,82,160],ExactTeleport:1b} at (100, 82, 106) and a platform under the exit. The player stands at (100.5, 81, 100.5) and throws a pearl at the gateway.
    • before (origin/main): the pearl flies through the gateway and away; after three throws the player is still at (100.5, 81, 100.5) with no advancement.
    • after: the player ends up at (100.5, 82, 160.5) on the exit platform, and chat shows "has made the advancement [Remote Getaway]".

Screenshots

Before: the pearl flies into the gateway and out the other side, and the player stays on the starting platform.

After: the player lands on the exit platform. Looking back, the starting platform and the gateway are visible far behind, and chat shows the Remote Getaway advancement.

🤖 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/4262 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix-3514-pearl-gateway` --- ### 📝 Commits (1) - [`95d9303`](https://github.com/horizon-rust/horizon/commit/95d9303204d2b24073fe2d80c91294c884716c46) Ender pearls go through End gateways ### 📊 Changes **2 files changed** (+254 additions, -48 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/end_gateway.rs` (+99 -0) 📝 `crates/horizon-client/src/game/end.rs` (+155 -48) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando personally. ## What and why Part of #3514 (the `ThrownEnderpearl.onInsideBlock` row). A thrown ender pearl flew straight through an End gateway and fell into the void, so the usual trick of pearling into a gateway to reach the outer islands did nothing. The cause: `find_end_gateway_portals` and `handle_end_gateway_portals` (game/end.rs) only collected dropped items and mobs, never projectiles. In vanilla every entity can use a gateway, and the pearl gets special handling. The fix, on the server side (server thread, LAN host, dedicated server): - Thrown ender pearls now go through the same gateway pass as items and mobs. A pearl whose move this tick swept through a gateway block (`end_gateway::pearl_gateway`, the 0.25 box from `previous` to `position`) is taken in by `EndGatewayBlock.entityInside`. The gateway's own 40-tick cooldown still applies, and the pearl's `Traveller` keeps its 300-tick portal cooldown. - On the next tick, before it moves again (`Entity.handlePortal`), the pearl is moved to the gateway's exit with no motion and rotation 0 (`EndGatewayBlock.getPortalDestination` builds a `TeleportTransition` with `Vec3.ZERO`, `0, 0` and no relative flags for a `ThrownEnderpearl`). It then falls from there and, as before, takes its owner to the spot where it lands. While the exit's chunk is still loading, the pearl waits in the same `arrivals` queue the items and mobs use. That queue now holds either a saved compound or a pearl, because projectiles are not saved. - `ThrownEnderpearl.teleport` calls `placePortalTicket`, so the chunk the pearl comes out in stays loaded for `TicketType.PORTAL`'s 300 ticks. Without that, a pearl coming out ~1000 blocks from its owner would fall through an unloaded chunk. - `ThrownEnderpearl.onInsideBlock` fires the owner's `ServerPlayer.onInsideBlock`, the `enter_block` trigger, for the gateway. For a guest's pearl it runs through `as_guest`. This is how vanilla grants **Remote Getaway** when a player pearls through a gateway. One difference from vanilla remains. In vanilla the pearl goes through in the same tick, because `ThrowableProjectile.tick` runs `applyEffectsFromBlocks` and then `Projectile.tick` (`baseTick`, `handlePortal`). Here it goes through on the next tick, before it moves, the way items and mobs already do in this pass. Its exit and its fall are the same, one tick later. Only pearls are covered. Vanilla also lets other projectiles (arrows, snowballs, and so on) through a gateway, keeping their velocity. That is a separate gap and is not in this row. ## 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 Read with `javap -c -p` on the 26.3 jar: - `ThrownEnderpearl.onInsideBlock(BlockState)`: on `Blocks.END_GATEWAY` with a `ServerPlayer` owner, calls `owner.onInsideBlock(state)` (the `enter_block` trigger). - `EndGatewayBlock.entityInside`: if `canUsePortal(false)` and the gateway is not cooling down, `setAsInsidePortal` then `TheEndGatewayBlockEntity.triggerCooldown`. - `EndGatewayBlock.getPortalDestination`: for an `instanceof ThrownEnderpearl`, `new TeleportTransition(level, pos, Vec3.ZERO, 0, 0, Set.of(), PLACE_PORTAL_TICKET)`. Other entities keep `Relative.DELTA` and `Relative.ROTATION`. - `ThrownEnderpearl.teleport`, `Entity.placePortalTicket` (`TicketType.PORTAL`, radius 3) and `TicketType.PORTAL` (timeout 300). No parity harness covers End gateway travel. The new unit tests in `end_gateway.rs` check the pearl part: a pearl thrown east is found in the gateway's block, goes through on the next tick, sits at the exit with no motion and rotation 0, falls straight down from it, and keeps its portal cooldown. A pearl flying over the gateway, and a snowball on the same path, are not taken in. ## Self-check `tools/pr_ready.py` does not run on Windows (it needs SIGHUP), so the steps were run by hand: - `cargo fmt --all -- --check`: clean - `cargo clippy -p horizon-client --all-targets -- -D warnings`: clean (`Finished`, no warnings) - `cargo test --profile fast -p horizon-client --lib end_gateway::` - before (the game/end.rs and end_gateway.rs code reverted, tests kept): does not compile, `error[E0425]: cannot find function pearl_gateway` / `place_pearl` - before, with `pearl_gateway` returning `None` and `place_pearl` doing nothing (the old behaviour, so the test compiles): `a_thrown_pearl_goes_through_the_gateway_and_falls_from_its_exit ... FAILED`, `left: None, right: Some(BlockPos { x: 702, y: 100, z: 0 })`, `test result: FAILED. 7 passed; 1 failed` - after: `test result: ok. 8 passed; 0 failed` - `cargo test --profile fast -p horizon-client --bin horizon-client end::`: `test result: ok. 3 passed; 0 failed` (the existing gateway exit tests) - In game, single player on the server thread (Windows, `--profile fast`). The window's player is a hub guest of the server thread there, the same path a LAN guest takes. Setup in the End: a platform at y 80 around (100, 100), an `end_gateway{exit_portal:[I;100,82,160],ExactTeleport:1b}` at (100, 82, 106) and a platform under the exit. The player stands at (100.5, 81, 100.5) and throws a pearl at the gateway. - before (origin/main): the pearl flies through the gateway and away; after three throws the player is still at (100.5, 81, 100.5) with no advancement. - after: the player ends up at (100.5, 82, 160.5) on the exit platform, and chat shows "has made the advancement [Remote Getaway]". ## Screenshots Before: the pearl flies into the gateway and out the other side, and the player stays on the starting platform. After: the player lands on the exit platform. Looking back, the starting platform and the gateway are visible far behind, and chat shows the Remote Getaway advancement. 🤖 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 05:13:12 +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#5527
No description provided.