[PR #4051] [MERGED] A camel and the husk on its back no longer push each other #5382

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

📋 Pull Request Information

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

Base: main ← Head: fix-3199


📝 Commits (10+)

  • 1a80673 Worldgen: structure mobs save the fields vanilla's chunk keeps
  • 52f0e38 Add the amplified, large-biome and single-biome world types
  • 22054ee Worldgen: chunk generation spawns its animals as vanilla, ticking or not
  • 729a224 Read the test registry without the explicit deref
  • 0104eea Format the world preset test
  • 815c09b Merge #2214 (world presets in the create-world screen)
  • bca77d1 Merge origin/main
  • d0b42fb Merge #2570
  • e5ebedd Merge #2585
  • bc5ec6f Structure mobs test: pass the world preset #2570 added to for_dimension

📊 Changes

237 files changed (+7623 additions, -1099 deletions)

View changed files

📝 README.md (+3 -0)
📝 crates/horizon-client-core/src/particle_type.rs (+12 -0)
📝 crates/horizon-client-render/src/assets.rs (+16 -2)
📝 crates/horizon-client-render/src/block_entity_render.rs (+12 -1)
📝 crates/horizon-client-render/src/brewing.rs (+35 -16)
📝 crates/horizon-client-render/src/chunk/block_entity.rs (+22 -0)
📝 crates/horizon-client-render/src/containers.rs (+8 -1)
📝 crates/horizon-client-render/src/datapack.rs (+46 -1)
📝 crates/horizon-client-render/src/lib.rs (+1 -0)
📝 crates/horizon-client-render/src/options_ui.rs (+99 -20)
📝 crates/horizon-client-render/src/particles.rs (+284 -3)
➕ crates/horizon-client-render/src/potent_sulfur.rs (+119 -0)
📝 crates/horizon-client-render/src/settings.rs (+7 -0)
📝 crates/horizon-client-render/src/signs.rs (+87 -4)
📝 crates/horizon-client-render/src/sprites.rs (+14 -0)
📝 crates/horizon-client-render/src/streaming.rs (+45 -3)
📝 crates/horizon-client-render/src/ui.rs (+15 -0)
📝 crates/horizon-client/examples/mod_port_probe.rs (+4 -3)
📝 crates/horizon-client/examples/probe/block_entity_anim_fixture.rs (+2 -1)
📝 crates/horizon-client/examples/probe/block_transform_fixture.rs (+2 -1)

...and 80 more files

📄 Description

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

What and why

Fixes #3199

The report describes two bugs. Both are server-side mob AI.

The camel slides backwards at high speed. Horizon's LivingEntity.pushEntities port (mobs/ai.rs::push_entities) pushed every pushable mob that overlapped the pusher's box. That included the pusher's own rider and its own vehicle. Camel.getPassengerAttachmentPoint seats the rider 0.5 toward the camel's front, inside the camel's box. So on every tick the husk pushed the camel backwards (a Push event), and the camel's own loop added a push away from the husk. The camel slid tail-first. In game, a camel summoned facing south slid about 4 blocks tail-first in 6 seconds, until it was stuck in the corner of a glass pen.

Vanilla Entity.push(Entity) returns at once when isPassengerOfSameVehicle is true, meaning both have the same getRootVehicle. push_entities now skips the push for such a mob. To do that, Seen carries the vehicle each mob rides (vehicle, next to passenger), and root_vehicle follows that chain. Two things stay as they were, because vanilla does the same:

  • The mob still counts for cramming, since EntitySelector.pushableBy keeps it.
  • Warden.doPush still runs for it, since it runs before Entity.push.

The camel sits down with the husk floating above it. CamelAi.RandomSitting only checked for a player rider (m.rider). Vanilla checkExtraStartConditions requires !hasControllingPassenger(), and a husk counts as one. Mob.getControllingPassenger returns the first passenger when it is a mob that canControlVehicle, meaning it is not in #non_controlling_rider (slime, magma cube, sulfur cube). The new riders::mob_controlled adds that check to the goal. The goal now also checks !isLeashed, which the same vanilla method checks.

Out of scope:

  • The separate gaps kacpherek noted on the issue (Camel.getDefaultDimensions and Camel.getRiddenRotation).
  • Entity.push(Entity) also never moves an entity that isVehicle. push_entities doesn't model that yet for any ridden mob, so a ridden camel can still be pushed by a mob that is not its passenger. That changes every ridden mob, so it is left for its own pull request. The unit test doesn't assert either way.

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 on the 26.3 client jar:

  • Entity.push(Entity) → isPassengerOfSameVehicle → getRootVehicle
  • LivingEntity.pushEntities, Level.getPushableEntities, EntitySelector.pushableBy
  • CamelAi$RandomSitting.checkExtraStartConditions: !isInWater && getPoseTime >= 400 && !isLeashed && onGround && !hasControllingPassenger && canCamelChangePose
  • Mob.getControllingPassenger, AbstractHorse.getControllingPassenger, Entity.canControlVehicle (#non_controlling_rider)
  • Camel.getPassengerAttachmentPoint

Harness: a new camel riders group in tools/command_exec_corpus.py, compared against vanilla's real server by tools/test_command_exec_parity.py. It summons a camel carrying a husk in a glass pen and sets the camel's movement_speed to 0, so only a push can move it. It ticks 100 and checks the camel is still within 4 blocks of its summon point. Then it ticks 500 more and checks LastPoseTick is not negative, meaning the camel is not sitting.

Unit tests:

  • mobs::ai::same_vehicle_push_tests::a_camel_and_its_rider_never_push_each_other: the camel neither pushes its husk nor is pushed by it, but it still pushes a zombie that overlaps it.
  • mobs::camel::tests::a_camel_with_a_husk_on_its_back_never_sits_down: RandomSitting never starts with a husk on the camel or with a lead on it. It does start with nothing on the camel or with a slime on it.

Both tests use a small shared builder, mobs::world::with_test_world.

Self-check

Run on Windows. tools/pr_ready.py doesn't run there, so these are the commands it would cover:

cargo fmt --all -- --check                                              # clean
cargo clippy -p horizon-client --all-targets -- -D warnings             # clean
cargo test --profile fast -p horizon-client --lib mobs::                # 132 passed, 0 failed (6 ignored)
python tools/test_command_exec_parity.py --only "camel riders"          # 4/4
python tools/test_command_exec_parity.py --only "riding"                # riding teleport 36/36, mob riding 12/12

Before (fix reverted, tests and corpus kept):

test mobs::ai::same_vehicle_push_tests::a_camel_and_its_rider_never_push_each_other ... FAILED
  assertion `left == right` failed: the camel pushes its own rider
    left: [2]
   right: []
test mobs::camel::tests::a_camel_with_a_husk_on_its_back_never_sits_down ... FAILED
  assertion `left == right` failed   (husk rider)
    left: Some(true)
   right: Some(false)

camel riders: 2/4 commands match
messages '/execute if entity @e[tag=camel_v,x=8,y=201,z=8,distance=..4]'
  vanilla {"messages": ["Test passed. Count: 1"], ...}
  rust    {"messages": ["Test failed"], ...}
messages '/execute if score camel camel_pose matches ..-1'
  vanilla {"messages": ["Test failed"], ...}
  rust    {"messages": ["Test passed"], ...}

After:

test mobs::ai::same_vehicle_push_tests::a_camel_and_its_rider_never_push_each_other ... ok
test mobs::camel::tests::a_camel_with_a_husk_on_its_back_never_sits_down ... ok
camel riders: 4/4 commands match

Screenshots

before: at night the ridden camel sits down under its husk rider

after: it stays standing while ridden

Tested in single player (creative, server on its thread) in a 23×23 glass pen. I summoned a camel facing south with a husk on its back and read its server position once a second with /data get entity.

  • Before, day: z went 538.0, 536.8, 535.5, 535.1, 534.7, 534.4, 533.9. The camel slid tail-first and turned, then stayed pinned in the pen's north-west corner.
  • Before, night: the camel sat down (LastPoseTick -1) and the husk floated above it, as in the report.
  • After, day: the camel stayed at exactly (208.5, 100, 538.5) for all 8 samples.
  • After, night: over 2400 sprinted night ticks, LastPoseTick stayed 0. The camel stayed standing, walked head-first at normal speed, and kept the husk seated on its back.

🤖 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/4051 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix-3199` --- ### 📝 Commits (10+) - [`1a80673`](https://github.com/horizon-rust/horizon/commit/1a80673d50561657398e977cdd4618b1011a5c07) Worldgen: structure mobs save the fields vanilla's chunk keeps - [`52f0e38`](https://github.com/horizon-rust/horizon/commit/52f0e38d4157f13c1547ffebf85cc930bd914d3f) Add the amplified, large-biome and single-biome world types - [`22054ee`](https://github.com/horizon-rust/horizon/commit/22054eee9000528cec04c9c95c4885248f9a8112) Worldgen: chunk generation spawns its animals as vanilla, ticking or not - [`729a224`](https://github.com/horizon-rust/horizon/commit/729a224eefe003cf08f4b8496c6344b8bd992c99) Read the test registry without the explicit deref - [`0104eea`](https://github.com/horizon-rust/horizon/commit/0104eeaf33853c0ac6a3b56f4715c012408cc291) Format the world preset test - [`815c09b`](https://github.com/horizon-rust/horizon/commit/815c09b1f8d3a011b8f93273aa94a2c152c43ac9) Merge #2214 (world presets in the create-world screen) - [`bca77d1`](https://github.com/horizon-rust/horizon/commit/bca77d1ac4af96674a51b828d05e8247b59d4670) Merge origin/main - [`d0b42fb`](https://github.com/horizon-rust/horizon/commit/d0b42fb88e7b94341f13c8f45b09b3e9f5115613) Merge #2570 - [`e5ebedd`](https://github.com/horizon-rust/horizon/commit/e5ebeddb904c71fce6615b3b1c8de9d515a0a5eb) Merge #2585 - [`bc5ec6f`](https://github.com/horizon-rust/horizon/commit/bc5ec6fb462aa524ff26dfbdaf5a9e2e6fb3da17) Structure mobs test: pass the world preset #2570 added to for_dimension ### 📊 Changes **237 files changed** (+7623 additions, -1099 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+3 -0) 📝 `crates/horizon-client-core/src/particle_type.rs` (+12 -0) 📝 `crates/horizon-client-render/src/assets.rs` (+16 -2) 📝 `crates/horizon-client-render/src/block_entity_render.rs` (+12 -1) 📝 `crates/horizon-client-render/src/brewing.rs` (+35 -16) 📝 `crates/horizon-client-render/src/chunk/block_entity.rs` (+22 -0) 📝 `crates/horizon-client-render/src/containers.rs` (+8 -1) 📝 `crates/horizon-client-render/src/datapack.rs` (+46 -1) 📝 `crates/horizon-client-render/src/lib.rs` (+1 -0) 📝 `crates/horizon-client-render/src/options_ui.rs` (+99 -20) 📝 `crates/horizon-client-render/src/particles.rs` (+284 -3) ➕ `crates/horizon-client-render/src/potent_sulfur.rs` (+119 -0) 📝 `crates/horizon-client-render/src/settings.rs` (+7 -0) 📝 `crates/horizon-client-render/src/signs.rs` (+87 -4) 📝 `crates/horizon-client-render/src/sprites.rs` (+14 -0) 📝 `crates/horizon-client-render/src/streaming.rs` (+45 -3) 📝 `crates/horizon-client-render/src/ui.rs` (+15 -0) 📝 `crates/horizon-client/examples/mod_port_probe.rs` (+4 -3) 📝 `crates/horizon-client/examples/probe/block_entity_anim_fixture.rs` (+2 -1) 📝 `crates/horizon-client/examples/probe/block_transform_fixture.rs` (+2 -1) _...and 80 more files_ </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves. ## What and why Fixes #3199 The report describes two bugs. Both are server-side mob AI. **The camel slides backwards at high speed.** Horizon's `LivingEntity.pushEntities` port (`mobs/ai.rs::push_entities`) pushed every pushable mob that overlapped the pusher's box. That included the pusher's own rider and its own vehicle. `Camel.getPassengerAttachmentPoint` seats the rider 0.5 toward the camel's front, inside the camel's box. So on every tick the husk pushed the camel backwards (a `Push` event), and the camel's own loop added a push away from the husk. The camel slid tail-first. In game, a camel summoned facing south slid about 4 blocks tail-first in 6 seconds, until it was stuck in the corner of a glass pen. Vanilla `Entity.push(Entity)` returns at once when `isPassengerOfSameVehicle` is true, meaning both have the same `getRootVehicle`. `push_entities` now skips the push for such a mob. To do that, `Seen` carries the vehicle each mob rides (`vehicle`, next to `passenger`), and `root_vehicle` follows that chain. Two things stay as they were, because vanilla does the same: - The mob still counts for cramming, since `EntitySelector.pushableBy` keeps it. - `Warden.doPush` still runs for it, since it runs before `Entity.push`. **The camel sits down with the husk floating above it.** `CamelAi.RandomSitting` only checked for a player rider (`m.rider`). Vanilla `checkExtraStartConditions` requires `!hasControllingPassenger()`, and a husk counts as one. `Mob.getControllingPassenger` returns the first passenger when it is a mob that `canControlVehicle`, meaning it is not in `#non_controlling_rider` (slime, magma cube, sulfur cube). The new `riders::mob_controlled` adds that check to the goal. The goal now also checks `!isLeashed`, which the same vanilla method checks. Out of scope: - The separate gaps kacpherek noted on the issue (`Camel.getDefaultDimensions` and `Camel.getRiddenRotation`). - `Entity.push(Entity)` also never moves an entity that `isVehicle`. `push_entities` doesn't model that yet for any ridden mob, so a ridden camel can still be pushed by a mob that is not its passenger. That changes every ridden mob, so it is left for its own pull request. The unit test doesn't assert either way. ## 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 on the 26.3 client jar: - `Entity.push(Entity)` → `isPassengerOfSameVehicle` → `getRootVehicle` - `LivingEntity.pushEntities`, `Level.getPushableEntities`, `EntitySelector.pushableBy` - `CamelAi$RandomSitting.checkExtraStartConditions`: `!isInWater && getPoseTime >= 400 && !isLeashed && onGround && !hasControllingPassenger && canCamelChangePose` - `Mob.getControllingPassenger`, `AbstractHorse.getControllingPassenger`, `Entity.canControlVehicle` (`#non_controlling_rider`) - `Camel.getPassengerAttachmentPoint` Harness: a new `camel riders` group in `tools/command_exec_corpus.py`, compared against vanilla's real server by `tools/test_command_exec_parity.py`. It summons a camel carrying a husk in a glass pen and sets the camel's `movement_speed` to 0, so only a push can move it. It ticks 100 and checks the camel is still within 4 blocks of its summon point. Then it ticks 500 more and checks `LastPoseTick` is not negative, meaning the camel is not sitting. Unit tests: - `mobs::ai::same_vehicle_push_tests::a_camel_and_its_rider_never_push_each_other`: the camel neither pushes its husk nor is pushed by it, but it still pushes a zombie that overlaps it. - `mobs::camel::tests::a_camel_with_a_husk_on_its_back_never_sits_down`: `RandomSitting` never starts with a husk on the camel or with a lead on it. It does start with nothing on the camel or with a slime on it. Both tests use a small shared builder, `mobs::world::with_test_world`. ## Self-check Run on Windows. `tools/pr_ready.py` doesn't run there, so these are the commands it would cover: ``` cargo fmt --all -- --check # clean cargo clippy -p horizon-client --all-targets -- -D warnings # clean cargo test --profile fast -p horizon-client --lib mobs:: # 132 passed, 0 failed (6 ignored) python tools/test_command_exec_parity.py --only "camel riders" # 4/4 python tools/test_command_exec_parity.py --only "riding" # riding teleport 36/36, mob riding 12/12 ``` Before (fix reverted, tests and corpus kept): ``` test mobs::ai::same_vehicle_push_tests::a_camel_and_its_rider_never_push_each_other ... FAILED assertion `left == right` failed: the camel pushes its own rider left: [2] right: [] test mobs::camel::tests::a_camel_with_a_husk_on_its_back_never_sits_down ... FAILED assertion `left == right` failed (husk rider) left: Some(true) right: Some(false) camel riders: 2/4 commands match messages '/execute if entity @e[tag=camel_v,x=8,y=201,z=8,distance=..4]' vanilla {"messages": ["Test passed. Count: 1"], ...} rust {"messages": ["Test failed"], ...} messages '/execute if score camel camel_pose matches ..-1' vanilla {"messages": ["Test failed"], ...} rust {"messages": ["Test passed"], ...} ``` After: ``` test mobs::ai::same_vehicle_push_tests::a_camel_and_its_rider_never_push_each_other ... ok test mobs::camel::tests::a_camel_with_a_husk_on_its_back_never_sits_down ... ok camel riders: 4/4 commands match ``` ## Screenshots ![before: at night the ridden camel sits down under its husk rider](https://raw.githubusercontent.com/d3grando/horizon/pr-assets/3199-1.png) ![after: it stays standing while ridden](https://raw.githubusercontent.com/d3grando/horizon/pr-assets/3199-2.png) Tested in single player (creative, server on its thread) in a 23×23 glass pen. I summoned a camel facing south with a husk on its back and read its server position once a second with `/data get entity`. - **Before, day:** z went 538.0, 536.8, 535.5, 535.1, 534.7, 534.4, 533.9. The camel slid tail-first and turned, then stayed pinned in the pen's north-west corner. - **Before, night:** the camel sat down (`LastPoseTick` -1) and the husk floated above it, as in the report. - **After, day:** the camel stayed at exactly (208.5, 100, 538.5) for all 8 samples. - **After, night:** over 2400 sprinted night ticks, `LastPoseTick` stayed 0. The camel stayed standing, walked head-first at normal speed, and kept the husk seated on its back. 🤖 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:12: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#5382
No description provided.