[GH-ISSUE #1518] [singleplayer] End gateways ignore mobs and dropped items #476

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/1518

🤖 Filed by an AI assistant (Codex).

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

  1. In the End, create a gateway with a valid exit and safe floors:
    /setblock 702 100 0 end_gateway{Age:201L,exit_portal:[I;8,100,0],ExactTeleport:1b}
  2. Put a cow inside it: /summon cow 702.5 100 .5 {NoAI:1b}.
  3. Repeat with a diamond item entity at [702.5,100.5,0.5]. Wait sixty ticks for each.

Expected: each entity travels through the gateway. Native Minecraft 26.3 places cow, item and player at [8.5,100,0.5].

Actual: the cow and item stay inside the source gateway in both modes. The player can subsequently use the same gateway, establishing that it is active. The player's incorrect destination is tracked separately in #1517.

Reproduced in two fresh paired sequences (cargo-end-{a,b}), using authoritative entity positions after processing. Native cargo-native-gateway-a qualifies both entity transfers and player use of the same configured gateway. The seven-diamond stack is preserved there.

Driver: tools/singleplayer_end_cargo_audit.py --case gateway.

Hypothesis: runtime End-gateway entry checks only visit players, omitting eligible non-player entities.

Acceptance: eligible mobs and dropped item stacks enter End gateways once, arrive at the appropriate exit and retain their data/counts in server-thread.

Originally created by @rdbtCVS on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/1518 > 🤖 Filed by an AI assistant (Codex). Tested `9dd9a836991e263b51d0cec0f690d40a0b09eecc`; affects **server-thread and old singleplayer**, explicitly selected from equivalent disposable worlds. 1. In the End, create a gateway with a valid exit and safe floors: `/setblock 702 100 0 end_gateway{Age:201L,exit_portal:[I;8,100,0],ExactTeleport:1b}` 2. Put a cow inside it: `/summon cow 702.5 100 .5 {NoAI:1b}`. 3. Repeat with a diamond item entity at [702.5,100.5,0.5]. Wait sixty ticks for each. Expected: each entity travels through the gateway. Native Minecraft 26.3 places cow, item and player at [8.5,100,0.5]. Actual: the cow and item stay inside the source gateway in both modes. The player can subsequently use the same gateway, establishing that it is active. The player's incorrect destination is tracked separately in #1517. Reproduced in two fresh paired sequences (`cargo-end-{a,b}`), using authoritative entity positions after processing. Native `cargo-native-gateway-a` qualifies both entity transfers and player use of the same configured gateway. The seven-diamond stack is preserved there. Driver: `tools/singleplayer_end_cargo_audit.py --case gateway`. Hypothesis: runtime End-gateway entry checks only visit players, omitting eligible non-player entities. Acceptance: eligible mobs and dropped item stacks enter End gateways once, arrive at the appropriate exit and retain their data/counts in server-thread.
Author
Owner

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

🤖 Agent: fixed in https://github.com/ludovic111/horizon/pull/2689 (branch fix/end-gateway-entities).

What was wrong. Only the player was ever checked for End gateways: Game::tick_end (the in-frame singleplayer) and Game::handle_server_portal (server-thread) look for the gateway the player stands in, and no other entity was looked at. A cow or a dropped stack inside a gateway therefore never went anywhere.

What the fix does. The entities now follow the vanilla path, in crates/horizon-client/src/game/end.rs and the new crates/horizon-client/src/end_gateway.rs:

  • find_end_gateway_portals finds the minecraft:end_gateway block the entity's box swept through (the Entity.checkInsideBlocks sweep the Nether portals already use) and lets the entity in through Game::gateway_enter, the server copy of EndGatewayBlock.entityInside — a cooling-down gateway (triggerCooldown, 40 ticks) takes nobody in, so one entity at a time goes through, as in vanilla.
  • handle_end_gateway_portals runs Entity.handlePortal for them on the next tick. The End gateway's transition time is 0 (Portal.getPortalTransitionTime), so the entity travels right away, and its portal cooldown (Entity.getDimensionChangingDelay, 300 ticks) keeps it from going back at once.
  • send_through_gateway saves the traveller's compound and takes it out of the world while its exit loads (as the player's own travel does), and resolve_end_gateway_arrivals puts it back at the gateway's exit with the same resolve_gateway job the player uses — so the item keeps its stack and the mob its data, and both land where the player lands.

resolve_gateway now reuses an exit that another traveller already found, so the player and an entity going through the same gateway do not build a second island for it.

Vanilla followed. EndGatewayBlock.entityInside, TheEndGatewayBlockEntity.getPortalPosition / triggerCooldown / isCoolingDown, Entity.checkInsideBlocks / setAsInsidePortal / handlePortal / getDimensionChangingDelay, PortalProcessor.processPortalTeleportation / processPortalCooldown, and Portal.getPortalTransitionTime (0 for the End gateway).

Verified. cargo fmt -p horizon-client and the focused tests of the new module, which holds the rules the entities follow (the sweep that finds the gateway, the portal process that travels one tick later, the arrival spot):

$ cargo test -p horizon-client --lib -- end_gateway::tests
running 6 tests
test end_gateway::tests::a_traveller_lands_at_the_bottom_centre_of_the_exit ... ok
test end_gateway::tests::an_entity_goes_through_the_gateway_on_the_tick_after_it_entered ... ok
test end_gateway::tests::an_entity_that_may_not_use_portals_stays_in_the_gateway ... ok
test end_gateway::tests::an_item_and_a_mob_in_a_gateway_are_found_in_it ... ok
test end_gateway::tests::an_entity_out_of_the_gateway_is_not_in_it ... ok
test end_gateway::tests::an_entity_falling_through_the_gateway_goes_through_it ... ok

test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 1214 filtered out; finished in 0.00s

The module is new, so those tests do not compile (and fail) without the change.

Not in this change. Where the gateway leads is the separate issue #1517: the entities arrive at the same exit the player arrives at, and Horizon still ignores a gateway's configured exit_portal / ExactTeleport fields (there is no End gateway block entity in the world yet), so the reproduction's gateway still leads to the End spawn rather than to [8.5,100,0.5]. That part is tracked in #1517 and is untouched here.

Leaving the issue open.

<!-- gh-comment-id:6434742141 --> @levzzz5154 commented on GitHub (Oct 27, 2026): 🤖 Agent: fixed in https://github.com/ludovic111/horizon/pull/2689 (branch `fix/end-gateway-entities`). **What was wrong.** Only the player was ever checked for End gateways: `Game::tick_end` (the in-frame singleplayer) and `Game::handle_server_portal` (server-thread) look for the gateway the *player* stands in, and no other entity was looked at. A cow or a dropped stack inside a gateway therefore never went anywhere. **What the fix does.** The entities now follow the vanilla path, in `crates/horizon-client/src/game/end.rs` and the new `crates/horizon-client/src/end_gateway.rs`: * `find_end_gateway_portals` finds the `minecraft:end_gateway` block the entity's box swept through (the `Entity.checkInsideBlocks` sweep the Nether portals already use) and lets the entity in through `Game::gateway_enter`, the server copy of `EndGatewayBlock.entityInside` — a cooling-down gateway (`triggerCooldown`, 40 ticks) takes nobody in, so one entity at a time goes through, as in vanilla. * `handle_end_gateway_portals` runs `Entity.handlePortal` for them on the next tick. The End gateway's transition time is 0 (`Portal.getPortalTransitionTime`), so the entity travels right away, and its portal cooldown (`Entity.getDimensionChangingDelay`, 300 ticks) keeps it from going back at once. * `send_through_gateway` saves the traveller's compound and takes it out of the world while its exit loads (as the player's own travel does), and `resolve_end_gateway_arrivals` puts it back at the gateway's exit with the same `resolve_gateway` job the player uses — so the item keeps its stack and the mob its data, and both land where the player lands. `resolve_gateway` now reuses an exit that another traveller already found, so the player and an entity going through the same gateway do not build a second island for it. **Vanilla followed.** `EndGatewayBlock.entityInside`, `TheEndGatewayBlockEntity.getPortalPosition` / `triggerCooldown` / `isCoolingDown`, `Entity.checkInsideBlocks` / `setAsInsidePortal` / `handlePortal` / `getDimensionChangingDelay`, `PortalProcessor.processPortalTeleportation` / `processPortalCooldown`, and `Portal.getPortalTransitionTime` (0 for the End gateway). **Verified.** `cargo fmt -p horizon-client` and the focused tests of the new module, which holds the rules the entities follow (the sweep that finds the gateway, the portal process that travels one tick later, the arrival spot): ``` $ cargo test -p horizon-client --lib -- end_gateway::tests running 6 tests test end_gateway::tests::a_traveller_lands_at_the_bottom_centre_of_the_exit ... ok test end_gateway::tests::an_entity_goes_through_the_gateway_on_the_tick_after_it_entered ... ok test end_gateway::tests::an_entity_that_may_not_use_portals_stays_in_the_gateway ... ok test end_gateway::tests::an_item_and_a_mob_in_a_gateway_are_found_in_it ... ok test end_gateway::tests::an_entity_out_of_the_gateway_is_not_in_it ... ok test end_gateway::tests::an_entity_falling_through_the_gateway_goes_through_it ... ok test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 1214 filtered out; finished in 0.00s ``` The module is new, so those tests do not compile (and fail) without the change. **Not in this change.** Where the gateway *leads* is the separate issue #1517: the entities arrive at the same exit the player arrives at, and Horizon still ignores a gateway's configured `exit_portal` / `ExactTeleport` fields (there is no End gateway block entity in the world yet), so the reproduction's gateway still leads to the End spawn rather than to `[8.5,100,0.5]`. That part is tracked in #1517 and is untouched here. Leaving the issue open.
Author
Owner

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

🤖 Agent: follow-up on https://github.com/ludovic111/horizon/pull/2689 (branch fix/end-gateway-entities, now merged with main).

Where the change stands. The mobs and the dropped items go through an End gateway now, in both the server-thread and the in-frame singleplayer, and they land where the gateway leads — the same place the player lands.

What upstream already did (so the branch is merged with it). main merged #2493: a gateway's exit lives in the gateway's own block entity (TheEndGatewayBlockEntity.setExitPosition), and the player travels to the exit the gateway was given. The branch here is merged with that, and the entities use the same GatewayJob, the same resolve_gateway and the same exit, so the player and the entities of one gateway end up in the same place. What main does not have is the entity travel: nothing there looks at an End gateway for anything but the player, so that part is still this PR.

What the entities do now.

  • find_end_gateway_portals finds the minecraft:end_gateway block the entity's box swept through (the Entity.checkInsideBlocks sweep) and lets the entity in through Game::gateway_enter, the server copy of EndGatewayBlock.entityInside: a cooling-down gateway (triggerCooldown, 40 ticks) takes nobody in, so one entity at a time goes through, as in vanilla.
  • handle_end_gateway_portals runs Entity.handlePortal for them on the next tick. The End gateway's transition time is 0 (Portal.getPortalTransitionTime), so the entity travels right away, and its portal cooldown (Entity.getDimensionChangingDelay, 300 ticks) keeps it from going back at once.
  • send_through_gateway saves the traveller's compound and takes it out of the world while its exit loads (as the player's own travel does), and resolve_end_gateway_arrivals puts it back at the exit once the exit's chunks have loaded, with the same resolve_gateway job the player uses. The exit another traveller already found is reused, so one gateway never builds two islands.
  • resolve_end_gateway_arrivals only drops the traveller when the resolution succeeds, and the chunks the exit needs are kept loaded while it waits.

Vanilla followed. EndGatewayBlock.entityInside, TheEndGatewayBlockEntity.getPortalPosition / setExitPosition / triggerCooldown / isCoolingDown, Entity.checkInsideBlocks / setAsInsidePortal / handlePortal / getDimensionChangingDelay, PortalProcessor.processPortalTeleportation / processPortalCooldown, and Portal.getPortalTransitionTime (0 for the End gateway).

Verified. The focused tests of the new horizon_client::end_gateway module (the sweep that finds the gateway, the portal process that travels one tick later, the arrival spot) and upstream's own tests for the player's exit:

$ cargo test -p horizon-client --lib -- end_gateway
running 9 tests
test end_gateway::tests::a_traveller_lands_at_the_bottom_centre_of_the_exit ... ok
test end_gateway::tests::an_entity_out_of_the_gateway_is_not_in_it ... ok
test end_gateway::tests::an_entity_that_may_not_use_portals_stays_in_the_gateway ... ok
test end_gateway::tests::an_item_and_a_mob_in_a_gateway_are_found_in_it ... ok
test end_gateway::tests::an_entity_goes_through_the_gateway_on_the_tick_after_it_entered ... ok
test end_gateway::tests::an_entity_falling_through_the_gateway_goes_through_it ... ok
test structure_blocks::tests::generated_end_gateway_keeps_its_exit ... ok
test save::tests::end_gateway_block_entity_round_trips ... ok
test save::tests::end_gateway_exit_requires_spawnable_bounds ... ok

test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 1198 filtered out; finished in 0.00s

$ cargo test -p horizon-client --bin horizon-client -- game::end
running 3 tests
test game::end::tests::a_saved_exit_moves_into_a_gateway_without_one ... ok
test game::end::tests::a_new_exit_keeps_the_gateways_exact_teleport ... ok
test game::end::tests::end_gateway_job_prefers_block_entity_then_legacy_then_heuristic ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 132 filtered out; finished in 0.00s

And end to end, with the new tools/singleplayer_end_cargo_audit.py: it plays the End in a scratch home, places a gateway beside the spawn platform, puts a cow and a seven-diamond stack in it, waits, and looks for them at the gateway's exit (the island 1024 blocks away, where findOrCreateValidTeleportPos puts it) with the stack still holding its seven diamonds:

$ 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

Both travellers leave the gateway at [104, 50, 0] and land together at the exit, and the stack keeps its seven diamonds.

Leaving the issue open.

<!-- gh-comment-id:6443204399 --> @levzzz5154 commented on GitHub (Oct 27, 2026): 🤖 Agent: follow-up on https://github.com/ludovic111/horizon/pull/2689 (branch `fix/end-gateway-entities`, now merged with `main`). **Where the change stands.** The mobs and the dropped items go through an End gateway now, in both the server-thread and the in-frame singleplayer, and they land where the gateway leads — the same place the player lands. **What upstream already did (so the branch is merged with it).** `main` merged #2493: a gateway's exit lives in the gateway's own block entity (`TheEndGatewayBlockEntity.setExitPosition`), and the player travels to the exit the gateway was given. The branch here is merged with that, and the entities use the same `GatewayJob`, the same `resolve_gateway` and the same exit, so the player and the entities of one gateway end up in the same place. What `main` does not have is the entity travel: nothing there looks at an End gateway for anything but the player, so that part is still this PR. **What the entities do now.** * `find_end_gateway_portals` finds the `minecraft:end_gateway` block the entity's box swept through (the `Entity.checkInsideBlocks` sweep) and lets the entity in through `Game::gateway_enter`, the server copy of `EndGatewayBlock.entityInside`: a cooling-down gateway (`triggerCooldown`, 40 ticks) takes nobody in, so one entity at a time goes through, as in vanilla. * `handle_end_gateway_portals` runs `Entity.handlePortal` for them on the next tick. The End gateway's transition time is 0 (`Portal.getPortalTransitionTime`), so the entity travels right away, and its portal cooldown (`Entity.getDimensionChangingDelay`, 300 ticks) keeps it from going back at once. * `send_through_gateway` saves the traveller's compound and takes it out of the world while its exit loads (as the player's own travel does), and `resolve_end_gateway_arrivals` puts it back at the exit once the exit's chunks have loaded, with the same `resolve_gateway` job the player uses. The exit another traveller already found is reused, so one gateway never builds two islands. * `resolve_end_gateway_arrivals` only drops the traveller when the resolution succeeds, and the chunks the exit needs are kept loaded while it waits. **Vanilla followed.** `EndGatewayBlock.entityInside`, `TheEndGatewayBlockEntity.getPortalPosition` / `setExitPosition` / `triggerCooldown` / `isCoolingDown`, `Entity.checkInsideBlocks` / `setAsInsidePortal` / `handlePortal` / `getDimensionChangingDelay`, `PortalProcessor.processPortalTeleportation` / `processPortalCooldown`, and `Portal.getPortalTransitionTime` (0 for the End gateway). **Verified.** The focused tests of the new `horizon_client::end_gateway` module (the sweep that finds the gateway, the portal process that travels one tick later, the arrival spot) and upstream's own tests for the player's exit: ``` $ cargo test -p horizon-client --lib -- end_gateway running 9 tests test end_gateway::tests::a_traveller_lands_at_the_bottom_centre_of_the_exit ... ok test end_gateway::tests::an_entity_out_of_the_gateway_is_not_in_it ... ok test end_gateway::tests::an_entity_that_may_not_use_portals_stays_in_the_gateway ... ok test end_gateway::tests::an_item_and_a_mob_in_a_gateway_are_found_in_it ... ok test end_gateway::tests::an_entity_goes_through_the_gateway_on_the_tick_after_it_entered ... ok test end_gateway::tests::an_entity_falling_through_the_gateway_goes_through_it ... ok test structure_blocks::tests::generated_end_gateway_keeps_its_exit ... ok test save::tests::end_gateway_block_entity_round_trips ... ok test save::tests::end_gateway_exit_requires_spawnable_bounds ... ok test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 1198 filtered out; finished in 0.00s $ cargo test -p horizon-client --bin horizon-client -- game::end running 3 tests test game::end::tests::a_saved_exit_moves_into_a_gateway_without_one ... ok test game::end::tests::a_new_exit_keeps_the_gateways_exact_teleport ... ok test game::end::tests::end_gateway_job_prefers_block_entity_then_legacy_then_heuristic ... ok test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 132 filtered out; finished in 0.00s ``` And end to end, with the new `tools/singleplayer_end_cargo_audit.py`: it plays the End in a scratch home, places a gateway beside the spawn platform, puts a cow and a seven-diamond stack in it, waits, and looks for them at the gateway's exit (the island 1024 blocks away, where `findOrCreateValidTeleportPos` puts it) with the stack still holding its seven diamonds: ``` $ 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 ``` Both travellers leave the gateway at [104, 50, 0] and land together at the exit, and the stack keeps its seven diamonds. Leaving the issue open.
Author
Owner

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

🤖 Agent: Covered by open PR #2689 ("Let mobs and dropped items through End gateways"). Leaving to the maintainer.

<!-- gh-comment-id:6443286657 --> @socksprox commented on GitHub (Oct 27, 2026): 🤖 Agent: Covered by open PR #2689 ("Let mobs and dropped items through End gateways"). Leaving to the maintainer.
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#476
No description provided.