[PR #7151] [MERGED] An anvil landing on turtle eggs drops its item on top of them, not inside #7379

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

📋 Pull Request Information

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

Base: main ← Head: fix/anvil-turtle-egg-drop


📝 Commits (1)

  • 3cbd09e An anvil landing on turtle eggs drops its item on top of them, not inside

📊 Changes

5 files changed (+161 additions, -33 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+3 -6)
📝 crates/horizon-client/src/game/falling_damage.rs (+7 -19)
📝 crates/horizon-world/src/level/falling.rs (+3 -7)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/LocatorBarClient.java (+19 -1)
➕ tools/test_anvil_turtle_egg_parity.py (+129 -0)

📄 Description

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

What and why

An anvil cannot replace turtle eggs, so vanilla's FallingBlockEntity.tick discards it where it came to rest, on top of the eggs, and drops its item with spawnAtLocation: an item at the entity's own position, with new ItemEntity's motion from the item's own random. Horizon dropped it with pop_resource, like a mined block: somewhere inside the eggs' cell, often inside the eggs' shape, so moveTowardsClosestSpace pushed it sideways tick after tick. Over 16 anvils the item ended up a median 1.5 blocks away (up to 2.5); in vanilla, the median is 0.6 (up to 1.4), and about half the items stay on the eggs. This is the anvil point of #5858.

  • game/falling_damage.rs: a block that breaks on landing drops its item through drop_falling_block at block.position (spawnAtLocation), not pop_resource (which also read block_drops instead of entity_drops). Fallable.onBrokenAfterFall's level event (1029 for an anvil) plays with the drop, only when the entity drops its item, as vanilla does; an anvil with DropItem:0b now breaks silently.
  • horizon-world level/falling.rs: falling_block_landed no longer plays 1029 itself on Landing::Broken; the caller does, under the drop condition.
  • game.rs drop_falling_block: the item's motion comes from the item's random (new_item_motion), not the level's, so the drop no longer advances the level random (also for the out-of-world drop).

Part of #5858 (the last open point; placement particles, the player's trample and armor stands are on main).

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

FallingBlockEntity.tick (landing branch), readAdditionalSaveData; Entity.spawnAtLocation (all four overloads); ItemEntity.<init>(Level, double, double, double, ItemStack); AnvilBlock.onBrokenAfterFall; TurtleEggBlock.canBeReplaced, canDestroyEgg (read with tools/rea_vanilla.py).

New harness tools/test_anvil_turtle_egg_parity.py (real vanilla and Horizon servers): eight anvils on stacks of one to four eggs, an anvil with DropItem:0b on eggs, and one landing on stone. It compares each level event (1029 / 1031), the position each item is added at, the eggs left, and that the no-drop anvil leaves no item. The test client (LocatorBarClient) gets two switches for it: events on|off records level events and spawns on|off records each non-player entity added, by type and position.

Horizon tells clients about an entity added after tick_lan (falling blocks tick later in Game::tick) one tick late, after its first move. The harness accepts that explicitly: an item counts as at-anvil at the cell's centre on top of the eggs (80.4375), or one tick on (+0.16 up, at most 0.1 sideways); vanilla must add its items exactly there. The old drop's random height never matches.

  • Before: +drop event 1029 32 80 0 0 (the no-drop anvil), and all eight items off the anvil, e.g. -drop spawn minecraft:item 0 at-anvil / +drop spawn minecraft:item 0.6076 80.2645 0.7916.
  • After: anvil turtle eggs: 38 results match vanilla.

In game (Windows 11, single player, horizon-ctl, offscreen): four anvils dropped on one to four eggs; the items lie 0.18, 0.64, 0.99 and 1.09 blocks from their anvils, one still on its eggs, and all eggs stay.

Other projects' code

none

Self-check

The Python failure is test_pr_ready.test_the_launcher_fallback_asks_for_a_feature_the_launcher_has, which fails the same way on a Windows checkout of upstream/main (it runs the launcher's clippy step through bash -c); this doesn't touch it. Linux CI runs it as usual.

pr_ready (tools/pr_ready.py --quick --base upstream/main on Evrim-PC, against upstream/main at d928d1cd6, 6 min 56 s)

Check Result
Scope ✅ 5 files, +161 −33
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 611 run, FAILED (errors=3, skipped=2) (1 min 29 s)
rustfmt ✅ (11 s)
clippy ✅ (1 min 43 s)
tests: horizon-client, horizon-world ✅ 1052 passed (2 min 55 s)
doc tests ✅ 0 passed (5 s)
content root tests ➖ content root untouched
mod API up to date ✅ (23 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 356 affected, to run in CI (--quick): active_effect_tick, active_effects, anchor, anvil_turtle_egg, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, bamboo, basic_feature, biome_chunk and 344 more

🤖 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/7151 **Author:** [@Ragbie](https://github.com/Ragbie) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/anvil-turtle-egg-drop` --- ### 📝 Commits (1) - [`3cbd09e`](https://github.com/horizon-rust/horizon/commit/3cbd09e448274f1ae12ebaf2326b929a12d0b374) An anvil landing on turtle eggs drops its item on top of them, not inside ### 📊 Changes **5 files changed** (+161 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+3 -6) 📝 `crates/horizon-client/src/game/falling_damage.rs` (+7 -19) 📝 `crates/horizon-world/src/level/falling.rs` (+3 -7) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/LocatorBarClient.java` (+19 -1) ➕ `tools/test_anvil_turtle_egg_parity.py` (+129 -0) </details> ### 📄 Description > 🤖 Opened by Ragbie's AI agent (Claude Code, Opus 5.5), not by Ragbie personally. ## What and why An anvil cannot replace turtle eggs, so vanilla's `FallingBlockEntity.tick` discards it where it came to rest, on top of the eggs, and drops its item with `spawnAtLocation`: an item at the entity's own position, with `new ItemEntity`'s motion from the item's own random. Horizon dropped it with `pop_resource`, like a mined block: somewhere inside the eggs' cell, often inside the eggs' shape, so `moveTowardsClosestSpace` pushed it sideways tick after tick. Over 16 anvils the item ended up a median 1.5 blocks away (up to 2.5); in vanilla, the median is 0.6 (up to 1.4), and about half the items stay on the eggs. This is the anvil point of #5858. - `game/falling_damage.rs`: a block that breaks on landing drops its item through `drop_falling_block` at `block.position` (`spawnAtLocation`), not `pop_resource` (which also read `block_drops` instead of `entity_drops`). `Fallable.onBrokenAfterFall`'s level event (1029 for an anvil) plays with the drop, only when the entity drops its item, as vanilla does; an anvil with `DropItem:0b` now breaks silently. - `horizon-world` `level/falling.rs`: `falling_block_landed` no longer plays 1029 itself on `Landing::Broken`; the caller does, under the drop condition. - `game.rs` `drop_falling_block`: the item's motion comes from the item's random (`new_item_motion`), not the level's, so the drop no longer advances the level random (also for the out-of-world drop). Part of #5858 (the last open point; placement particles, the player's trample and armor stands are on main). ## 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 `FallingBlockEntity.tick` (landing branch), `readAdditionalSaveData`; `Entity.spawnAtLocation` (all four overloads); `ItemEntity.<init>(Level, double, double, double, ItemStack)`; `AnvilBlock.onBrokenAfterFall`; `TurtleEggBlock.canBeReplaced`, `canDestroyEgg` (read with `tools/rea_vanilla.py`). New harness `tools/test_anvil_turtle_egg_parity.py` (real vanilla and Horizon servers): eight anvils on stacks of one to four eggs, an anvil with `DropItem:0b` on eggs, and one landing on stone. It compares each level event (1029 / 1031), the position each item is added at, the eggs left, and that the no-drop anvil leaves no item. The test client (`LocatorBarClient`) gets two switches for it: `events on|off` records level events and `spawns on|off` records each non-player entity added, by type and position. Horizon tells clients about an entity added after `tick_lan` (falling blocks tick later in `Game::tick`) one tick late, after its first move. The harness accepts that explicitly: an item counts as `at-anvil` at the cell's centre on top of the eggs (`80.4375`), or one tick on (`+0.16` up, at most `0.1` sideways); vanilla must add its items exactly there. The old drop's random height never matches. - Before: `+drop event 1029 32 80 0 0` (the no-drop anvil), and all eight items off the anvil, e.g. `-drop spawn minecraft:item 0 at-anvil` / `+drop spawn minecraft:item 0.6076 80.2645 0.7916`. - After: `anvil turtle eggs: 38 results match vanilla`. In game (Windows 11, single player, `horizon-ctl`, offscreen): four anvils dropped on one to four eggs; the items lie 0.18, 0.64, 0.99 and 1.09 blocks from their anvils, one still on its eggs, and all eggs stay. ## Other projects' code none ## Self-check The Python failure is `test_pr_ready.test_the_launcher_fallback_asks_for_a_feature_the_launcher_has`, which fails the same way on a Windows checkout of upstream/main (it runs the launcher's clippy step through `bash -c`); this doesn't touch it. Linux CI runs it as usual. **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on Evrim-PC, against upstream/main at d928d1cd6, 6 min 56 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +161 −33 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 611 run, FAILED (errors=3, skipped=2) (1 min 29 s) | | rustfmt | ✅ (11 s) | | clippy | ✅ (1 min 43 s) | | tests: horizon-client, horizon-world | ✅ 1052 passed (2 min 55 s) | | doc tests | ✅ 0 passed (5 s) | | content root tests | ➖ content root untouched | | mod API up to date | ✅ (23 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 356 affected, to run in CI (--quick): active_effect_tick, active_effects, anchor, anvil_turtle_egg, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, bamboo, basic_feature, biome_chunk and 344 more | 🤖 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 06:38:39 +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#7379
No description provided.