[PR #7380] [MERGED] Seven mobs hang their lead where vanilla does #7565

Closed
opened 2026-11-03 07:19:54 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7380
Author: @MSedgeMC
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: fix/mob-leash-offsets


📝 Commits (2)

  • 975e4b5 Seven mobs hang their lead where vanilla does
  • a8892e3 Test the lead offsets of the pig, rabbit, parrot, ocelot and happy ghast

📊 Changes

5 files changed (+58 additions, -5 deletions)

View changed files

📝 crates/horizon-client/src/mobs/leash.rs (+52 -0)
📝 tools/port_map/game-011.tsv (+1 -1)
📝 tools/port_map/game-012.tsv (+1 -0)
📝 tools/port_map/game-013.tsv (+3 -3)
📝 tools/port_map/game2-003.tsv (+1 -1)

📄 Description

Vanilla's Leashable.getLeashOffset default is new Vec3(0.0, getEyeHeight(), getBbWidth() * 0.4F), and seven mob classes override it: Pig.getLeashOffset, Rabbit.getLeashOffset and Strider.getLeashOffset return 0.6F * getEyeHeight(), Parrot.getLeashOffset and Ocelot.getLeashOffset return 0.5F * getEyeHeight(), each keeping the bbWidth * 0.4 in front, and HappyGhast.getLeashOffset returns Vec3.ZERO, so a happy ghast's rope attaches at its feet.

Horizon's leash::leash_offset special-cased the llama, wolf, allay, camel, bee, the iron, snow and copper golems and the fox, and every other mob fell through to the default. For these seven that meant the rope was drawn at the full eye height instead of 0.6 or half of it — and for a happy ghast 2.6 blocks above its feet instead of at them. The offset is also what the rope's geometry is solved from, so the sag and the direction of the lead were off with it.

Proven: the vanilla side is the 26.3 client jar, net/minecraft/world/entity/Leashable.getValue's default plus the overrides in animal/pig/Pig, animal/rabbit/Rabbit, monster/Strider, animal/parrot/Parrot, animal/feline/Ocelot and animal/happyghast/HappyGhast, all one-liners of the form above.

On the build VM, cargo test -q -p horizon-client-lib --lib lead_where_vanilla_does passes 2 tests, the new a_pig_a_rabbit_a_parrot_an_ocelot_and_a_ghast_hang_their_lead_where_vanilla_does among them, and cargo test -q -p horizon-client-lib --lib mobs::leash:: passes 14. Deleting the new factor arm makes the new test fail on minecraft:pig: height 0.7649999856948853 vs 0.45900002121925354 (the default eye height against 0.6 * eye), and deleting only the happy ghast's makes it fail on minecraft:happy_ghast: height 2.5999999046325684 vs 0, so both halves of the change are what the test turns over. cargo clippy -q -p horizon-client-lib --lib prints nothing and rustfmt --edition 2024 --check is clean on the file.

Not proven: I did not run the game. The in-game check is a lead on a pig, a rabbit, a parrot, an ocelot, a strider and a happy ghast, whose rope should meet the mob at 0.6 or half of the eye height and, on the ghast, at its feet.

Not fixed here: a sulfur cube's rope point (SulfurCube.getLeashOffset is bbHeight / 2 on the centre) stays on the default, because leash::can_be_leashed answers no for it — a monster category — so its offset would be unreachable until that gate is looked at.

Corrects the Ocelot.getLeashOffset, Parrot.getLeashOffset, Pig.getLeashOffset, Rabbit.getLeashOffset and Strider.getLeashOffset rows, and adds the HappyGhast.getLeashOffset one, in tools/port_map/.


🔄 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/7380 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/mob-leash-offsets` --- ### 📝 Commits (2) - [`975e4b5`](https://github.com/horizon-rust/horizon/commit/975e4b5c8db1fa68cba39a2a966644dbc9942938) Seven mobs hang their lead where vanilla does - [`a8892e3`](https://github.com/horizon-rust/horizon/commit/a8892e3a87a1f74ead439dbfa21a9813a92e235f) Test the lead offsets of the pig, rabbit, parrot, ocelot and happy ghast ### 📊 Changes **5 files changed** (+58 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/leash.rs` (+52 -0) 📝 `tools/port_map/game-011.tsv` (+1 -1) 📝 `tools/port_map/game-012.tsv` (+1 -0) 📝 `tools/port_map/game-013.tsv` (+3 -3) 📝 `tools/port_map/game2-003.tsv` (+1 -1) </details> ### 📄 Description Vanilla's `Leashable.getLeashOffset` default is `new Vec3(0.0, getEyeHeight(), getBbWidth() * 0.4F)`, and seven mob classes override it: `Pig.getLeashOffset`, `Rabbit.getLeashOffset` and `Strider.getLeashOffset` return `0.6F * getEyeHeight()`, `Parrot.getLeashOffset` and `Ocelot.getLeashOffset` return `0.5F * getEyeHeight()`, each keeping the `bbWidth * 0.4` in front, and `HappyGhast.getLeashOffset` returns `Vec3.ZERO`, so a happy ghast's rope attaches at its feet. Horizon's `leash::leash_offset` special-cased the llama, wolf, allay, camel, bee, the iron, snow and copper golems and the fox, and every other mob fell through to the default. For these seven that meant the rope was drawn at the full eye height instead of 0.6 or half of it — and for a happy ghast 2.6 blocks above its feet instead of at them. The offset is also what the rope's geometry is solved from, so the sag and the direction of the lead were off with it. **Proven:** the vanilla side is the 26.3 client jar, `net/minecraft/world/entity/Leashable.getValue`'s default plus the overrides in `animal/pig/Pig`, `animal/rabbit/Rabbit`, `monster/Strider`, `animal/parrot/Parrot`, `animal/feline/Ocelot` and `animal/happyghast/HappyGhast`, all one-liners of the form above. On the build VM, `cargo test -q -p horizon-client-lib --lib lead_where_vanilla_does` passes 2 tests, the new `a_pig_a_rabbit_a_parrot_an_ocelot_and_a_ghast_hang_their_lead_where_vanilla_does` among them, and `cargo test -q -p horizon-client-lib --lib mobs::leash::` passes 14. Deleting the new factor arm makes the new test fail on `minecraft:pig: height 0.7649999856948853 vs 0.45900002121925354` (the default eye height against `0.6 * eye`), and deleting only the happy ghast's makes it fail on `minecraft:happy_ghast: height 2.5999999046325684 vs 0`, so both halves of the change are what the test turns over. `cargo clippy -q -p horizon-client-lib --lib` prints nothing and `rustfmt --edition 2024 --check` is clean on the file. **Not proven:** I did not run the game. The in-game check is a lead on a pig, a rabbit, a parrot, an ocelot, a strider and a happy ghast, whose rope should meet the mob at 0.6 or half of the eye height and, on the ghast, at its feet. Not fixed here: a sulfur cube's rope point (`SulfurCube.getLeashOffset` is `bbHeight / 2` on the centre) stays on the default, because `leash::can_be_leashed` answers no for it — a `monster` category — so its offset would be unreachable until that gate is looked at. Corrects the `Ocelot.getLeashOffset`, `Parrot.getLeashOffset`, `Pig.getLeashOffset`, `Rabbit.getLeashOffset` and `Strider.getLeashOffset` rows, and adds the `HappyGhast.getLeashOffset` one, in `tools/port_map/`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 07:19:54 +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#7565
No description provided.