[PR #7622] A pearl whose owner is dead or asleep is discarded #7723

Open
opened 2026-11-03 07:23:02 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7622
Author: @MSedgeMC
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: fix/pearl-owner-gate


📝 Commits (3)

  • 77c6a82 fix: a pearl whose owner is dead or asleep is discarded
  • 4e52511 test: a dead or sleeping owner cannot take its pearl
  • e33a2f1 port_map: ThrownEnderpearl.isAllowedToTeleportOwner names owner_can_take_pearl

📊 Changes

3 files changed (+34 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/game/creatures.rs (+10 -1)
📝 crates/horizon-client/src/projectiles.rs (+23 -0)
📝 tools/port_map/game2-006.tsv (+1 -1)

📄 Description

What and why

A thrown ender pearl teleported its owner even when that owner was dead or asleep.
Vanilla asks isAllowedToTeleportOwner first and discards the pearl when the owner
cannot take it.

Vanilla reference

ThrownEnderpearl.onHit(HitResult) (javap -p -c), after the 32 portal particles:

 99: aload_0
100: invokevirtual #38   // Method getOwner:()LEntity;
103: astore        3
104: aload_3
105: ifnull        116
108: aload_3
109: aload_2
110: invokestatic  #156  // Method isAllowedToTeleportOwner:(LEntity;LLevel;)Z
113: ifne          121
116: aload_0
117: invokevirtual #160  // Method discard:()V
120: return

and the helper, in the owner's own dimension:

14: aload_0
15: instanceof    #294  // class LivingEntity
18: ifeq          46
...
26: aload_2
27: invokevirtual #302  // Method LivingEntity.isAlive:()Z
30: ifeq          44
33: aload_2
34: invokevirtual #305  // Method LivingEntity.isSleeping:()Z
37: ifne          44
40: iconst_1
41: goto          45
44: iconst_0
45: ireturn

(another dimension takes canUsePortal(true) at 51-56).

Horizon lacked it: Game::projectile_hit's EnderPearl arm teleported whenever
p.owner == Some(Who::Player) and a player existed, so with
ender_pearls_vanish_on_death off a dead player's pearl still moved them to where
it landed, and a player in bed was pulled out of it — both took the 5
minecraft:ender_pearl damage.

The change adds horizon_client::projectiles::owner_can_take_pearl — the
same-dimension half of the vanilla rule — and reads it in the pearl's hit.

Other projects' code

none

Proven:

  • cargo test -q -p horizon-client-lib --lib pearl_owner_tests ->
    running 1 test ... test result: ok. 1 passed; 0 failed (1462 filtered out).
    a_dead_or_sleeping_owner_cannot_take_its_pearl pins the vanilla table
    isAlive() && !isSleeping(); the sleeping and dead rows are the two cases the
    pearl's hit used to let through, since it only asked p.owner == Some(Who::Player) && self.player.is_some().
  • cargo clippy -q -p horizon-client-lib --lib and cargo clippy -q -p horizon-client --lib (the crate that holds Game::projectile_hit) are both
    silent; cargo test -q -p horizon-client --lib builds the changed
    game/creatures.rs. rustfmt --edition 2024 --check clean on both files.
  • python3 tools/port_ledger.py map-check tools/port_map/game2-006.tsv against a
    ledger rebuilt with this branch's tree -> 140 rows, no problems.

Not proven: no in-game throw while dead or asleep: Game::projectile_hit needs
a whole client, so the wiring is compiled and reviewed but not driven. The
other-dimension branch (canUsePortal(true)) is not implemented, and
ThrownEnderpearl.canTeleport's seen-credits test stays a missing row.


🔄 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/7622 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/pearl-owner-gate` --- ### 📝 Commits (3) - [`77c6a82`](https://github.com/horizon-rust/horizon/commit/77c6a82155109691806ea313aead9b28d5341138) fix: a pearl whose owner is dead or asleep is discarded - [`4e52511`](https://github.com/horizon-rust/horizon/commit/4e525110d7816351fa0b0c2281fa8609b1168e56) test: a dead or sleeping owner cannot take its pearl - [`e33a2f1`](https://github.com/horizon-rust/horizon/commit/e33a2f1fb3c57c4545c05d103c9a88bd702d8fd0) port_map: ThrownEnderpearl.isAllowedToTeleportOwner names owner_can_take_pearl ### 📊 Changes **3 files changed** (+34 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/creatures.rs` (+10 -1) 📝 `crates/horizon-client/src/projectiles.rs` (+23 -0) 📝 `tools/port_map/game2-006.tsv` (+1 -1) </details> ### 📄 Description ## What and why A thrown ender pearl teleported its owner even when that owner was dead or asleep. Vanilla asks `isAllowedToTeleportOwner` first and discards the pearl when the owner cannot take it. ## Vanilla reference `ThrownEnderpearl.onHit(HitResult)` (`javap -p -c`), after the 32 portal particles: ``` 99: aload_0 100: invokevirtual #38 // Method getOwner:()LEntity; 103: astore 3 104: aload_3 105: ifnull 116 108: aload_3 109: aload_2 110: invokestatic #156 // Method isAllowedToTeleportOwner:(LEntity;LLevel;)Z 113: ifne 121 116: aload_0 117: invokevirtual #160 // Method discard:()V 120: return ``` and the helper, in the owner's own dimension: ``` 14: aload_0 15: instanceof #294 // class LivingEntity 18: ifeq 46 ... 26: aload_2 27: invokevirtual #302 // Method LivingEntity.isAlive:()Z 30: ifeq 44 33: aload_2 34: invokevirtual #305 // Method LivingEntity.isSleeping:()Z 37: ifne 44 40: iconst_1 41: goto 45 44: iconst_0 45: ireturn ``` (another dimension takes `canUsePortal(true)` at 51-56). Horizon lacked it: `Game::projectile_hit`'s EnderPearl arm teleported whenever `p.owner == Some(Who::Player)` and a player existed, so with `ender_pearls_vanish_on_death` off a dead player's pearl still moved them to where it landed, and a player in bed was pulled out of it — both took the 5 `minecraft:ender_pearl` damage. The change adds `horizon_client::projectiles::owner_can_take_pearl` — the same-dimension half of the vanilla rule — and reads it in the pearl's hit. ## Other projects' code none **Proven:** - `cargo test -q -p horizon-client-lib --lib pearl_owner_tests` -> `running 1 test ... test result: ok. 1 passed; 0 failed` (1462 filtered out). `a_dead_or_sleeping_owner_cannot_take_its_pearl` pins the vanilla table `isAlive() && !isSleeping()`; the sleeping and dead rows are the two cases the pearl's hit used to let through, since it only asked `p.owner == Some(Who::Player) && self.player.is_some()`. - `cargo clippy -q -p horizon-client-lib --lib` and `cargo clippy -q -p horizon-client --lib` (the crate that holds `Game::projectile_hit`) are both silent; `cargo test -q -p horizon-client --lib` builds the changed `game/creatures.rs`. `rustfmt --edition 2024 --check` clean on both files. - `python3 tools/port_ledger.py map-check tools/port_map/game2-006.tsv` against a ledger rebuilt with this branch's tree -> `140 rows, no problems.` **Not proven:** no in-game throw while dead or asleep: `Game::projectile_hit` needs a whole client, so the wiring is compiled and reviewed but not driven. The other-dimension branch (`canUsePortal(true)`) is not implemented, and `ThrownEnderpearl.canTeleport`'s seen-credits test stays a `missing` row. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#7723
No description provided.