[PR #7669] Items and armor stands take fluids from the entity trait #7750

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

📋 Pull Request Information

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

Base: main ← Head: refactor/entity-fluids-items


📝 Commits (2)

  • f91e66a Items and armor stands take fluids and bubble columns from the Entity trait
  • 2970bd9 Merge remote-tracking branch 'origin/main' into refactor/entity-fluids-items

📊 Changes

7 files changed (+241 additions, -115 deletions)

View changed files

📝 crates/horizon-client/src/entities.rs (+145 -55)
📝 crates/horizon-client/src/entities/fluids.rs (+27 -28)
📝 crates/horizon-client/src/game.rs (+3 -2)
📝 crates/horizon-client/src/game/armor_stands.rs (+10 -18)
📝 crates/horizon-client/src/game/entity.rs (+50 -1)
📝 crates/horizon-client/src/game/remote.rs (+3 -2)
📝 crates/horizon-client/src/game/tnt.rs (+3 -9)

📄 Description

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

What and why

Slice 9b of #6509, part of #6544. After #7037, dropped items and armor stands still called the fluid update and the bubble column push from inside their own ticks in horizon-client, which cannot see the Entity trait in the game crate. Now each tick is split where the push happened, and the game runs the trait's defaults between the halves:

  • Item: push_by_fluid, ItemEntity::tick_move, push_by_bubble_column, ItemEntity::tick_settle, push_by_fluid again (one helper, tick_item, used by the server tick and the client-side copy).
  • Armor stand: push_by_fluid, ArmorStand::tick_move, push_by_bubble_column_over (it collects the surface positions for the bubble particles), ArmorStand::tick_settle.
  • New default Entity::push_by_bubble_column_over (takes a closure for the surface positions, generic, so static). push_by_bubble_column calls it; TNT's inline column push now does too.
  • Item and stand give their eye height through fluid_eye_y; a marker stand is !is_pushed_by_fluid, as its old early return was.
  • Armor stands now answer is_no_gravity and get_default_gravity (0.08) through EntityRules; their tick reads those instead of its own field and constant. This removes a &mut dyn FnMut from the stand tick.

No behaviour change is intended. 7 files, +241 -115.

Part of #6544

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

Entity.updateFluidHeightAndDoFluidPushing, BubbleColumnBlock.entityInside through applyEffectsFromBlocks, Entity.isNoGravity/getGravity, ItemEntity.tick (fluid update before and after the move, column push in the move), LivingEntity.travel for the stand. Same sources as #7037.

Proof

Side-by-side scene items_stands_fluids against the real server (dedicated servers, flat world, no player): item and armor stand, each with and without NoGravity, in water, lava, a bubble column up (soul sand), a bubble column down (magma), and a stream; 12 ticks, Pos and Motion read every tick, tolerance 1e-6. Lava uses a netherite ingot and an Invulnerable stand so they stay. The tool fails entities in non-ticking chunks and flags scenes where nothing moves; neither fired (vanilla: 31 of 40 probed values changed).

values matching vanilla
origin/main 451 of 520
this change 451 of 520

Before and after output is identical line for line, including the 69 mismatches. Those mismatches are all in the stands without NoGravity in lava and in both bubble columns (for example stand_up_g Motion y at tick 1: vanilla 0.115, Horizon 0.091; stand_lava_g at tick 3: vanilla -0.035, Horizon -0.2305). They were there before and are not touched here. Items, and stands in water, in a stream and with NoGravity, match.

Unit tests: pr_ready --quick, 2161 passed in horizon-client and horizon-client-lib; rustfmt reformatted one call after that run and passes on its own.

Tick cost

Rule from #6509: no dyn, no allocation per walk. One dyn is removed (the stand tick's closure); nothing allocates in the walk; dispatch is static.

Measured, one round, under flock, dev profile test (not optimised), 20000 ticks per batch, 5 batches, in a water pool, median ns per tick (machine load about 1.8 in both runs):

base this change
item tick 8793 8922
stand tick 3530 3643

That is 1.5% and 3.2% slower, about 130 ns and 110 ns per entity per tick, in an unoptimised build. Both batches ran as separate test processes; the unit tests' own tick wrapper stands in for the game's tick_item in the item row. An earlier attempt at the base run failed to start (no assets in its tree) and was rerun; no result was discarded.

What is left in #6544

  • Mobs (mobs/living.rs) keep their own fluid update and bubble column push.
  • The thrown ender pearl's bubble column push (game/creatures.rs) is inline, with its own box.
  • Arrows and other projectiles keep their own is_pushed_by_fluid in the movement code.

So #6544 stays open after this.

Harnesses

Run locally, DISPLAY=:0 HORIZON_E2E_HEADLESS=1, --fresh, the ones covering fluids, items, stands, boats, projectiles and entity lists. CI runs the full --changed set (256 harnesses).

PASS held_drop 18s
PASS entity_particles 23s
PASS trident 11s
PASS remote_fireworks 29s
PASS remote_fireball 33s
PASS arrow 18s
PASS boat_authority 26s
PASS water_splash 127s
PASS living_fluid 147s
PASS underwater_magma 152s
PASS server_entities 173s
PASS spawn_egg_fluid 177s
PASS boat_submerged 270s
PASS inventory_pickup 397s
PASS armor_stand_turtle_egg 530s
15 passed, 0 failed in 8.8 min.

A refactor with no behaviour change; proved by script, no human played this change.

A refactor with no behaviour change; proved by script, no human played this change.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick on Valhalla, against origin/main at ed3948f79, 10 min 19 s)

Check Result
Scope ✅ 7 files, +241 −115
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 614 passed (29 s)
rustfmt ✅ (7 s)
Rust ⚠️ 1.98.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with rustup update
clippy ✅ (1 min 50 s)
tests: horizon-client, horizon-client-lib ✅ 2161 passed (7 min 30 s)
doc tests ✅ 0 passed (4 s)
content root tests ➖ content root untouched
mod API up to date ✅ (14 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 256 affected, to run in CI (--quick): anvil_turtle_egg, armor_stand_turtle_egg, arrow, arrow_wind_charge, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, block_tint, block_transformer and 244 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Claude Code

https://claude.ai/code/session_018zuDTsnyHkP28bzn3u7S3m


🔄 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/7669 **Author:** [@HrafnaValkyrja](https://github.com/HrafnaValkyrja) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `refactor/entity-fluids-items` --- ### 📝 Commits (2) - [`f91e66a`](https://github.com/horizon-rust/horizon/commit/f91e66a520421e782871a03f265ae52f7dbb2252) Items and armor stands take fluids and bubble columns from the Entity trait - [`2970bd9`](https://github.com/horizon-rust/horizon/commit/2970bd933a83bb0659441b00e1452fa156f8a481) Merge remote-tracking branch 'origin/main' into refactor/entity-fluids-items ### 📊 Changes **7 files changed** (+241 additions, -115 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entities.rs` (+145 -55) 📝 `crates/horizon-client/src/entities/fluids.rs` (+27 -28) 📝 `crates/horizon-client/src/game.rs` (+3 -2) 📝 `crates/horizon-client/src/game/armor_stands.rs` (+10 -18) 📝 `crates/horizon-client/src/game/entity.rs` (+50 -1) 📝 `crates/horizon-client/src/game/remote.rs` (+3 -2) 📝 `crates/horizon-client/src/game/tnt.rs` (+3 -9) </details> ### 📄 Description > 🤖 Opened by Valkyrie's AI agent (Claude Code, Opus 5.5), not by Valkyrie herself. ## What and why Slice 9b of #6509, part of #6544. After #7037, dropped items and armor stands still called the fluid update and the bubble column push from inside their own ticks in `horizon-client`, which cannot see the `Entity` trait in the game crate. Now each tick is split where the push happened, and the game runs the trait's defaults between the halves: - Item: `push_by_fluid`, `ItemEntity::tick_move`, `push_by_bubble_column`, `ItemEntity::tick_settle`, `push_by_fluid` again (one helper, `tick_item`, used by the server tick and the client-side copy). - Armor stand: `push_by_fluid`, `ArmorStand::tick_move`, `push_by_bubble_column_over` (it collects the surface positions for the bubble particles), `ArmorStand::tick_settle`. - New default `Entity::push_by_bubble_column_over` (takes a closure for the surface positions, generic, so static). `push_by_bubble_column` calls it; TNT's inline column push now does too. - Item and stand give their eye height through `fluid_eye_y`; a marker stand is `!is_pushed_by_fluid`, as its old early return was. - Armor stands now answer `is_no_gravity` and `get_default_gravity` (0.08) through `EntityRules`; their tick reads those instead of its own field and constant. This removes a `&mut dyn FnMut` from the stand tick. No behaviour change is intended. 7 files, +241 -115. Part of #6544 ## 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 - [x] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference `Entity.updateFluidHeightAndDoFluidPushing`, `BubbleColumnBlock.entityInside` through `applyEffectsFromBlocks`, `Entity.isNoGravity`/`getGravity`, `ItemEntity.tick` (fluid update before and after the move, column push in the move), `LivingEntity.travel` for the stand. Same sources as #7037. ## Proof Side-by-side scene `items_stands_fluids` against the real server (dedicated servers, flat world, no player): item and armor stand, each with and without `NoGravity`, in water, lava, a bubble column up (soul sand), a bubble column down (magma), and a stream; 12 ticks, Pos and Motion read every tick, tolerance 1e-6. Lava uses a netherite ingot and an `Invulnerable` stand so they stay. The tool fails entities in non-ticking chunks and flags scenes where nothing moves; neither fired (vanilla: 31 of 40 probed values changed). | | values matching vanilla | |---|---| | origin/main | 451 of 520 | | this change | 451 of 520 | Before and after output is identical line for line, including the 69 mismatches. Those mismatches are all in the stands without `NoGravity` in lava and in both bubble columns (for example `stand_up_g` Motion y at tick 1: vanilla 0.115, Horizon 0.091; `stand_lava_g` at tick 3: vanilla -0.035, Horizon -0.2305). They were there before and are not touched here. Items, and stands in water, in a stream and with `NoGravity`, match. Unit tests: `pr_ready --quick`, 2161 passed in horizon-client and horizon-client-lib; rustfmt reformatted one call after that run and passes on its own. ## Tick cost Rule from #6509: no `dyn`, no allocation per walk. One `dyn` is removed (the stand tick's closure); nothing allocates in the walk; dispatch is static. Measured, one round, under `flock`, dev profile test (not optimised), 20000 ticks per batch, 5 batches, in a water pool, median ns per tick (machine load about 1.8 in both runs): | | base | this change | |---|---|---| | item tick | 8793 | 8922 | | stand tick | 3530 | 3643 | That is 1.5% and 3.2% slower, about 130 ns and 110 ns per entity per tick, in an unoptimised build. Both batches ran as separate test processes; the unit tests' own tick wrapper stands in for the game's `tick_item` in the item row. An earlier attempt at the base run failed to start (no assets in its tree) and was rerun; no result was discarded. ## What is left in #6544 - Mobs (`mobs/living.rs`) keep their own fluid update and bubble column push. - The thrown ender pearl's bubble column push (`game/creatures.rs`) is inline, with its own box. - Arrows and other projectiles keep their own `is_pushed_by_fluid` in the movement code. So #6544 stays open after this. ## Harnesses Run locally, `DISPLAY=:0 HORIZON_E2E_HEADLESS=1`, `--fresh`, the ones covering fluids, items, stands, boats, projectiles and entity lists. CI runs the full `--changed` set (256 harnesses). ``` PASS held_drop 18s PASS entity_particles 23s PASS trident 11s PASS remote_fireworks 29s PASS remote_fireball 33s PASS arrow 18s PASS boat_authority 26s PASS water_splash 127s PASS living_fluid 147s PASS underwater_magma 152s PASS server_entities 173s PASS spawn_egg_fluid 177s PASS boat_submerged 270s PASS inventory_pickup 397s PASS armor_stand_turtle_egg 530s 15 passed, 0 failed in 8.8 min. ``` A refactor with no behaviour change; proved by script, no human played this change. A refactor with no behaviour change; proved by script, no human played this change. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on Valhalla, against origin/main at ed3948f79, 10 min 19 s) | Check | Result | | --- | --- | | Scope | ✅ 7 files, +241 −115 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 614 passed (29 s) | | rustfmt | ✅ (7 s) | | Rust | ⚠️ 1.98.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with `rustup update` | | clippy | ✅ (1 min 50 s) | | tests: horizon-client, horizon-client-lib | ✅ 2161 passed (7 min 30 s) | | doc tests | ✅ 0 passed (4 s) | | content root tests | ➖ content root untouched | | mod API up to date | ✅ (14 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 256 affected, to run in CI (--quick): anvil_turtle_egg, armor_stand_turtle_egg, arrow, arrow_wind_charge, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, block_tint, block_transformer and 244 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018zuDTsnyHkP28bzn3u7S3m --- <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#7750
No description provided.