[PR #7610] A spider sits on a narrow vehicle by its own rule #7714

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

📋 Pull Request Information

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

Base: main ← Head: fix/spider-vehicle-attachment


📝 Commits (4)

  • 30f3de0 A spider sits on a narrow vehicle by its own rule
  • bc9b4e8 Test where a spider sits on a narrow vehicle
  • 48f2326 Spell the spider seat test's floats as f32
  • ea8c7a3 Take the early return out of the spider seat test

📊 Changes

6 files changed (+63 additions, -12 deletions)

View changed files

📝 crates/horizon-client/src/game/boat_passengers.rs (+2 -1)
📝 crates/horizon-client/src/game/minecarts.rs (+2 -1)
📝 crates/horizon-client/src/game/passengers.rs (+4 -2)
📝 crates/horizon-client/src/game/tnt.rs (+2 -1)
📝 crates/horizon-client/src/mobs/riders.rs (+52 -6)
📝 tools/port_map/classes-01.tsv (+1 -1)

📄 Description

Behaviour: a spider or cave spider riding a vehicle no wider than itself now sits at the spider's own attachment height instead of the type default: 0.3125 of its scale for a spider, 0.21875 for a cave spider. A wider vehicle (a boat, a minecart, a horse) keeps the old seat.

Vanilla javap -p -c -constants -cp /tmp/cj net.minecraft.world.entity.monster.spider.Spider.getVehicleAttachmentPoint(Entity):

 0: aload_1
 1: invokevirtual #320               // Method Entity.getBbWidth:()F   (the vehicle)
 4: aload_0
 5: invokevirtual #325               // Method getBbWidth:()F          (the rider)
 8: fcmpg
 9: ifgt          31                 // vehicle wider than the rider: super
12: new Vec3
16: dconst_0                         // x
17: ldc2_w        #328               // double 0.3125d
20: aload_0
21: invokevirtual getScale:()F
24: f2d / 25: dmul                   // y = 0.3125 * getScale()
26: dconst_0                         // z
30: areturn
31: aload_0 / 32: aload_1
33: invokespecial Monster.getVehicleAttachmentPoint

net.minecraft.world.entity.monster.spider.CaveSpider.getVehicleAttachmentPoint(Entity) is the same shape with 0.21875d and invokespecial Spider.getVehicleAttachmentPoint as its super — and that super call sees the same vehicle width, so a wider vehicle still ends at the type default.

What Horizon got wrong: mobs/riders.rs::vehicle_attachment took only the rider, so no species rule could read the vehicle's box. Spiders fell through to _ => 0.0 and sat 0.3125 (spider) or 0.21875 (cave spider) too low on anything narrow enough, e.g. a chicken jockey's 0.4-wide chicken or another spider's 1.4-wide body for a cave spider. This was already recorded as a gap in tools/port_map/classes-01.tsv.

vehicle_attachment now takes the vehicle's getBbWidth, and every call site passes what that vehicle is: a mob's width() and a text display's 0 (game/passengers.rs), a boat's 1.375 (game/boat_passengers.rs), a minecart's and primed TNT's 0.98 (game/minecarts.rs, game/tnt.rs).

Test: mobs::riders::tests::a_spider_sits_by_its_own_rule_on_a_narrow_vehicle builds a real spider and cave spider and checks 0.3125 and 0.21875 against a 0.4-wide vehicle (a chicken), the type default 0.0 against a 2.0-wide one, and 0.4375 for a cave spider with minecraft:scale 2.

Proven: the bytecode above; the branch condition is vehicle.getBbWidth() <= this.getBbWidth(), which is why a boat (1.375) still takes the spider's rule for a 1.4-wide spider but not for a 0.7-wide cave spider — both cases are in the test. cargo clippy -q -p horizon-client-lib --lib is silent and the tree compiles (cargo check -p horizon-client-lib --lib).

Not proven: VM cooling down, CI will run it. The build VM went unreachable with the run still queued (503 host_unavailable, after its shared build lock had been held by other work for over an hour), so the test has not been watched failing and passing there yet. Reading the code, without the fix both spiders take _ => 0.0, so the test would report 0.0 where it wants 0.3125 (spider) and 0.21875 (cave spider); CI will confirm. Also not done: an in-game run — the seat is proved as the number positionRider subtracts, not by watching a spider jockey on a chicken. The text display's zero width comes from its entity type, not from a bytecode read of EntityType.TEXT_DISPLAY, and it only changes a spider riding one.


🔄 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/7610 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/spider-vehicle-attachment` --- ### 📝 Commits (4) - [`30f3de0`](https://github.com/horizon-rust/horizon/commit/30f3de004fc2484d7676f2846512d8059598d157) A spider sits on a narrow vehicle by its own rule - [`bc9b4e8`](https://github.com/horizon-rust/horizon/commit/bc9b4e85be2f2ad7e7c9518321c94d75ad4919ec) Test where a spider sits on a narrow vehicle - [`48f2326`](https://github.com/horizon-rust/horizon/commit/48f232631447fb0968dd34012a741206fd372ac9) Spell the spider seat test's floats as f32 - [`ea8c7a3`](https://github.com/horizon-rust/horizon/commit/ea8c7a339d08dd1d5a35f89899ce1bfb69108a53) Take the early return out of the spider seat test ### 📊 Changes **6 files changed** (+63 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/boat_passengers.rs` (+2 -1) 📝 `crates/horizon-client/src/game/minecarts.rs` (+2 -1) 📝 `crates/horizon-client/src/game/passengers.rs` (+4 -2) 📝 `crates/horizon-client/src/game/tnt.rs` (+2 -1) 📝 `crates/horizon-client/src/mobs/riders.rs` (+52 -6) 📝 `tools/port_map/classes-01.tsv` (+1 -1) </details> ### 📄 Description **Behaviour:** a spider or cave spider riding a vehicle no wider than itself now sits at the spider's own attachment height instead of the type default: 0.3125 of its scale for a spider, 0.21875 for a cave spider. A wider vehicle (a boat, a minecart, a horse) keeps the old seat. Vanilla `javap -p -c -constants -cp /tmp/cj net.minecraft.world.entity.monster.spider.Spider.getVehicleAttachmentPoint(Entity)`: ``` 0: aload_1 1: invokevirtual #320 // Method Entity.getBbWidth:()F (the vehicle) 4: aload_0 5: invokevirtual #325 // Method getBbWidth:()F (the rider) 8: fcmpg 9: ifgt 31 // vehicle wider than the rider: super 12: new Vec3 16: dconst_0 // x 17: ldc2_w #328 // double 0.3125d 20: aload_0 21: invokevirtual getScale:()F 24: f2d / 25: dmul // y = 0.3125 * getScale() 26: dconst_0 // z 30: areturn 31: aload_0 / 32: aload_1 33: invokespecial Monster.getVehicleAttachmentPoint ``` `net.minecraft.world.entity.monster.spider.CaveSpider.getVehicleAttachmentPoint(Entity)` is the same shape with `0.21875d` and `invokespecial Spider.getVehicleAttachmentPoint` as its `super` — and that super call sees the same vehicle width, so a wider vehicle still ends at the type default. **What Horizon got wrong:** `mobs/riders.rs::vehicle_attachment` took only the rider, so no species rule could read the vehicle's box. Spiders fell through to `_ => 0.0` and sat 0.3125 (spider) or 0.21875 (cave spider) too low on anything narrow enough, e.g. a chicken jockey's 0.4-wide chicken or another spider's 1.4-wide body for a cave spider. This was already recorded as a gap in `tools/port_map/classes-01.tsv`. `vehicle_attachment` now takes the vehicle's `getBbWidth`, and every call site passes what that vehicle is: a mob's `width()` and a text display's 0 (`game/passengers.rs`), a boat's 1.375 (`game/boat_passengers.rs`), a minecart's and primed TNT's 0.98 (`game/minecarts.rs`, `game/tnt.rs`). **Test:** `mobs::riders::tests::a_spider_sits_by_its_own_rule_on_a_narrow_vehicle` builds a real spider and cave spider and checks 0.3125 and 0.21875 against a 0.4-wide vehicle (a chicken), the type default 0.0 against a 2.0-wide one, and 0.4375 for a cave spider with `minecraft:scale` 2. **Proven:** the bytecode above; the branch condition is `vehicle.getBbWidth() <= this.getBbWidth()`, which is why a boat (1.375) still takes the spider's rule for a 1.4-wide spider but not for a 0.7-wide cave spider — both cases are in the test. `cargo clippy -q -p horizon-client-lib --lib` is silent and the tree compiles (`cargo check -p horizon-client-lib --lib`). **Not proven: VM cooling down, CI will run it.** The build VM went unreachable with the run still queued (503 `host_unavailable`, after its shared build lock had been held by other work for over an hour), so the test has not been watched failing and passing there yet. Reading the code, without the fix both spiders take `_ => 0.0`, so the test would report 0.0 where it wants 0.3125 (spider) and 0.21875 (cave spider); CI will confirm. Also not done: an in-game run — the seat is proved as the number `positionRider` subtracts, not by watching a spider jockey on a chicken. The text display's zero width comes from its entity type, not from a bytecode read of `EntityType.TEXT_DISPLAY`, and it only changes a spider riding one. --- <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#7714
No description provided.