[PR #5432] [MERGED] Sheared wool pops out of the sheep as vanilla's does #6285

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5432
Author: @CocofireHD
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: fix/sheared-wool-pop


📝 Commits (1)

  • f084e54 Sheared wool pops out of the sheep as vanilla's does

📊 Changes

1 file changed (+21 additions, -7 deletions)

View changed files

📝 crates/horizon-client/src/game/creatures.rs (+21 -7)

📄 Description

🤖 Opened by CocofireHD's AI agent (Hermes Agent, deepseek-v4.1-flash), not by CocofireHD personally.

What and why

Sheared wool now leaves the sheep the way vanilla launches it: with the ItemEntity constructor's motion plus Sheep.shear's own spread, spawned a block above the feet, with the default pickup delay. Mushroom drops keep the constructor's motion but no pickup delay, as MushroomCow.shear builds them by hand.

Fixes #5280 ("Sheared wool drops instantly instead of popping out").

Horizon's drop loop applied only the shear spread to a zero base (y <= 0.05) and spawned at center + 0.5, so the wool had almost no upward velocity and fell straight down. The constructor motion is exactly what dispenser::new_item_motion() already produces for every other dropped stack, so the loop reuses it and adds the spread only for wool; the wool flag also carries the pickup delay, since spawnAtLocation calls setDefaultPickUpDelay and MushroomCow's hand-built ItemEntity does not.

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

From the pinned 26.3 client.jar (javap -p -c):

Sheep.lambda$shear$0(ServerLevel, ItemStack):
  17: Entity.spawnAtLocation(ServerLevel, ItemStack, float)   // fconst_1 == 1.0F
  32: item.getDeltaMovement()
  39..58: (nextFloat() - nextFloat()) * 0.1f    // x
  60..72: nextFloat() * 0.05f                   // y
  73..96: (nextFloat() - nextFloat()) * 0.1f    // z
  97: Vec3.add  ->  setDeltaMovement

ItemEntity.<init>(Level, double, double, double, ItemStack):
  28..61: setDeltaMovement(nextDouble()*0.2-0.1, 0.2, nextDouble()*0.2-0.1)

Entity.spawnAtLocation(ServerLevel, ItemStack, Vec3):
  new ItemEntity(level, getX(), getY() + offset.y, getZ(), stack); setDefaultPickUpDelay(); addFreshEntity

MushroomCow.lambda$shear$1: new ItemEntity(level, getX(), getY(1.0), getZ(), stack); addFreshEntity

No harness covers mob interaction drops; game/dispenser.rs (SheepDispenseItemBehavior) already used spawn_at_location(at, 1.0, ..) plus the sheep's spread and is untouched.

Other projects' code

none

Self-check

**pr_ready** (`tools/pr_ready.py --quick` on Windows, against origin/main at 1e16d0723, 8 min 47 s)

| Check | Result |
| --- | --- |
| Scope | 1 file, +21 -7 (creatures.rs only) |
| Cargo.lock | pass, unchanged |
| Public tree | pass |
| Python tests | fail: 505 run, 1 error — `test_port_ledger` imports `tests.test_class_index`, which is not in the tree; fails identically on clean main |
| rustfmt | pass |
| clippy | pass (`-D warnings`) |
| tests: horizon-client | 1490 passed, 8 failed — all 8 in the `lan_bot` integration test, which is open issue #5364 and has PR #5387 in flight; not touched by this change |
| doc tests | pass |
| Parity | not run (`--quick`); CI's parity job picks the harnesses |

Verification note, said plainly rather than implied: the control measurement below shows the mechanism works, but I could not drive the shear itself in this build. Breaking a dirt block in the same fast client drops an item that rises y=120.51 -> 120.73 (+0.22) before settling — that is new_item_motion()'s 0.2 applied on the wire, the same motion the wool now starts with (plus the shear spread). A right-click on a sheep through horizon-ctl never reaches interact_mob in server-thread single player: look-at-entity aims at a sheep two blocks away and the pick still returns the stone block behind it, and attack <id> answers hit: true while health and hurt_time stay unchanged. That looks like a separate picking bug and is left out of this PR, so an in-game before/after of the wool itself is still owed.

Screenshots

None: no frame could be captured for the reason above.

Allow edits by maintainers

Yes — please push fixups directly.


🔄 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/5432 **Author:** [@CocofireHD](https://github.com/CocofireHD) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/sheared-wool-pop` --- ### 📝 Commits (1) - [`f084e54`](https://github.com/horizon-rust/horizon/commit/f084e54852cc3d72e5726ec45935354708c9e045) Sheared wool pops out of the sheep as vanilla's does ### 📊 Changes **1 file changed** (+21 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/creatures.rs` (+21 -7) </details> ### 📄 Description > 🤖 Opened by CocofireHD's AI agent (Hermes Agent, deepseek-v4.1-flash), not by CocofireHD personally. ## What and why Sheared wool now leaves the sheep the way vanilla launches it: with the `ItemEntity` constructor's motion plus `Sheep.shear`'s own spread, spawned a block above the feet, with the default pickup delay. Mushroom drops keep the constructor's motion but no pickup delay, as `MushroomCow.shear` builds them by hand. Fixes #5280 ("Sheared wool drops instantly instead of popping out"). Horizon's drop loop applied only the shear spread to a zero base (`y <= 0.05`) and spawned at `center + 0.5`, so the wool had almost no upward velocity and fell straight down. The constructor motion is exactly what `dispenser::new_item_motion()` already produces for every other dropped stack, so the loop reuses it and adds the spread only for wool; the `wool` flag also carries the pickup delay, since `spawnAtLocation` calls `setDefaultPickUpDelay` and `MushroomCow`'s hand-built `ItemEntity` does not. ## 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 From the pinned 26.3 `client.jar` (`javap -p -c`): ``` Sheep.lambda$shear$0(ServerLevel, ItemStack): 17: Entity.spawnAtLocation(ServerLevel, ItemStack, float) // fconst_1 == 1.0F 32: item.getDeltaMovement() 39..58: (nextFloat() - nextFloat()) * 0.1f // x 60..72: nextFloat() * 0.05f // y 73..96: (nextFloat() - nextFloat()) * 0.1f // z 97: Vec3.add -> setDeltaMovement ItemEntity.<init>(Level, double, double, double, ItemStack): 28..61: setDeltaMovement(nextDouble()*0.2-0.1, 0.2, nextDouble()*0.2-0.1) Entity.spawnAtLocation(ServerLevel, ItemStack, Vec3): new ItemEntity(level, getX(), getY() + offset.y, getZ(), stack); setDefaultPickUpDelay(); addFreshEntity MushroomCow.lambda$shear$1: new ItemEntity(level, getX(), getY(1.0), getZ(), stack); addFreshEntity ``` No harness covers mob interaction drops; `game/dispenser.rs` (`SheepDispenseItemBehavior`) already used `spawn_at_location(at, 1.0, ..)` plus the sheep's spread and is untouched. ## Other projects' code none ## Self-check ``` **pr_ready** (`tools/pr_ready.py --quick` on Windows, against origin/main at 1e16d0723, 8 min 47 s) | Check | Result | | --- | --- | | Scope | 1 file, +21 -7 (creatures.rs only) | | Cargo.lock | pass, unchanged | | Public tree | pass | | Python tests | fail: 505 run, 1 error — `test_port_ledger` imports `tests.test_class_index`, which is not in the tree; fails identically on clean main | | rustfmt | pass | | clippy | pass (`-D warnings`) | | tests: horizon-client | 1490 passed, 8 failed — all 8 in the `lan_bot` integration test, which is open issue #5364 and has PR #5387 in flight; not touched by this change | | doc tests | pass | | Parity | not run (`--quick`); CI's parity job picks the harnesses | ``` Verification note, said plainly rather than implied: the control measurement below shows the mechanism works, but I could not drive the shear itself in this build. Breaking a dirt block in the same `fast` client drops an item that rises **y=120.51 -> 120.73 (+0.22)** before settling — that is `new_item_motion()`'s 0.2 applied on the wire, the same motion the wool now starts with (plus the shear spread). A right-click on a sheep through `horizon-ctl` never reaches `interact_mob` in server-thread single player: `look-at-entity` aims at a sheep two blocks away and the pick still returns the stone block behind it, and `attack <id>` answers `hit: true` while health and `hurt_time` stay unchanged. That looks like a separate picking bug and is left out of this PR, so an in-game before/after of the wool itself is still owed. ## Screenshots None: no frame could be captured for the reason above. ## Allow edits by maintainers Yes — please push fixups directly. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:17:45 +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#6285
No description provided.