[PR #6971] [MERGED] Mobs that land from a fall throw up the block's dust #7241

Closed
opened 2026-11-03 06:36:13 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/6950-mob-landing-dust


📝 Commits (4)

  • a66ec46 Mobs that land from a fall throw up the block's dust
  • c4cda8f Merge origin/main
  • bb3193e Merge origin/main
  • 3eef82f Merge origin/main

📊 Changes

3 files changed (+82 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game/creatures.rs (+7 -0)
📝 crates/horizon-client/src/mobs.rs (+7 -0)
📝 crates/horizon-client/src/mobs/living.rs (+68 -0)

📄 Description

🤖 Opened by both Akirabane's AI agent (Claude Code), and Akirabane Himself after his review.

Fixes #6950

What was wrong

LivingEntity.checkFallDamage is not only the player's. On the server, when an entity lands with a fall distance it takes power = max(floor(fallDistance + 1.0E-6 - safeFallDistance), 0) and, if power > 0 and the block it lands on is not air, sends that block's BLOCK particles: (int)(min(0.2F + power / 15, 2.5) * 150) of them, zero spread, speed 0.15 (read with javap on the 26.3 server jar). Horizon did it for the player (#2435, living_landing::check_living_fall_damage), but a mob's check_fall_damage in mobs/living.rs went straight to fall_on_block, so a mob landing from a height threw up nothing.

What changed

  • mobs/living.rs: check_fall_damage calls a new landing_dust before fall_on_block, as vanilla sends the particles before Entity.checkFallDamage. landing_dust_count is the count above (none within the mob's safe fall distance) and landing_dust_at the position the player's code already uses: at the mob, or on the face of the block it landed on when its feet are over another column.
  • mobs.rs: MobEvent::LandingDust { state, at, count }.
  • game/creatures.rs: handle_mob_events draws it with the existing Game::landing_dust, which also sends it to the LAN guests.

How it was checked

Unit tests: a_landing_throws_up_dust_by_the_power_of_the_fall (no dust within the safe distance, a fall of 7 over 3 gives 70, a long fall is capped at 375, a mob with a bigger safe distance gets none) and landing_dust_is_pulled_to_the_block_it_landed_on.

In the game (horizon-ctl launch --offscreen, creative world), a cow summoned above a stone floor, the block particle counter of horizon-ctl status read before the summon and 6 s after, on a build of origin/main and on this branch:

Cow dropped from Before After
2 blocks +0 +0
15 blocks (power 12) +0 +150
40 blocks (power capped) +0 +375

Self-check

tools/pr_ready.py --quick --base origin/main:

Check Result
Scope 3 files, +82 −0
Cargo.lock unchanged
rustfmt, clippy ✅
tests: horizon-client, horizon-client-lib ✅ 2055 passed
mod API up to date ❌ new_hook_placeholder_is_reported_then_filled compares LF with CRLF text on my Windows checkout, untouched here
Python tests 4 errors from my machine's setup (a global tests package, no launcher build), untouched here
Parity not run (--quick): the CI parity job picks the affected harnesses

Label: a fix, no feature label.


🔄 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/6971 **Author:** [@Akirabane](https://github.com/Akirabane) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/6950-mob-landing-dust` --- ### 📝 Commits (4) - [`a66ec46`](https://github.com/horizon-rust/horizon/commit/a66ec46254090c10fbb8b4cd5614b1d9b8d80e13) Mobs that land from a fall throw up the block's dust - [`c4cda8f`](https://github.com/horizon-rust/horizon/commit/c4cda8f6cb1e073a98a711aa4faac46b2cbf1eb8) Merge origin/main - [`bb3193e`](https://github.com/horizon-rust/horizon/commit/bb3193ef942744b14c1e70a0aebae8dd747ddd91) Merge origin/main - [`3eef82f`](https://github.com/horizon-rust/horizon/commit/3eef82f7ebbcc666f4e0905a1f9b1e03ee98c824) Merge origin/main ### 📊 Changes **3 files changed** (+82 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/creatures.rs` (+7 -0) 📝 `crates/horizon-client/src/mobs.rs` (+7 -0) 📝 `crates/horizon-client/src/mobs/living.rs` (+68 -0) </details> ### 📄 Description > 🤖 Opened by both Akirabane's AI agent (Claude Code), and Akirabane Himself after his review. Fixes #6950 ## What was wrong `LivingEntity.checkFallDamage` is not only the player's. On the server, when an entity lands with a fall distance it takes `power = max(floor(fallDistance + 1.0E-6 - safeFallDistance), 0)` and, if `power > 0` and the block it lands on is not air, sends that block's `BLOCK` particles: `(int)(min(0.2F + power / 15, 2.5) * 150)` of them, zero spread, speed `0.15` (read with `javap` on the 26.3 server jar). Horizon did it for the player (#2435, `living_landing::check_living_fall_damage`), but a mob's `check_fall_damage` in `mobs/living.rs` went straight to `fall_on_block`, so a mob landing from a height threw up nothing. ## What changed - `mobs/living.rs`: `check_fall_damage` calls a new `landing_dust` before `fall_on_block`, as vanilla sends the particles before `Entity.checkFallDamage`. `landing_dust_count` is the count above (none within the mob's safe fall distance) and `landing_dust_at` the position the player's code already uses: at the mob, or on the face of the block it landed on when its feet are over another column. - `mobs.rs`: `MobEvent::LandingDust { state, at, count }`. - `game/creatures.rs`: `handle_mob_events` draws it with the existing `Game::landing_dust`, which also sends it to the LAN guests. ## How it was checked Unit tests: `a_landing_throws_up_dust_by_the_power_of_the_fall` (no dust within the safe distance, a fall of 7 over 3 gives 70, a long fall is capped at 375, a mob with a bigger safe distance gets none) and `landing_dust_is_pulled_to_the_block_it_landed_on`. In the game (`horizon-ctl launch --offscreen`, creative world), a cow summoned above a stone floor, the `block` particle counter of `horizon-ctl status` read before the summon and 6 s after, on a build of `origin/main` and on this branch: | Cow dropped from | Before | After | | --- | --- | --- | | 2 blocks | +0 | +0 | | 15 blocks (power 12) | +0 | +150 | | 40 blocks (power capped) | +0 | +375 | ## Self-check `tools/pr_ready.py --quick --base origin/main`: | Check | Result | | --- | --- | | Scope | 3 files, +82 −0 | | Cargo.lock | unchanged | | rustfmt, clippy | ✅ | | tests: horizon-client, horizon-client-lib | ✅ 2055 passed | | mod API up to date | ❌ `new_hook_placeholder_is_reported_then_filled` compares LF with CRLF text on my Windows checkout, untouched here | | Python tests | 4 errors from my machine's setup (a global `tests` package, no launcher build), untouched here | | Parity | not run (`--quick`): the CI parity job picks the affected harnesses | Label: a fix, no `feature` label. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:36:13 +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#7241
No description provided.