[PR #6481] [MERGED] Arrows, orbs, TNT, items, boats and minecarts honour NoGravity #6905

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6481
Author: @HrafnaValkyrja
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/nogravity-entities


📝 Commits (1)

  • 50583c8 Honour NoGravity on arrows, orbs, TNT, items, boats and minecarts

📊 Changes

14 files changed (+80 additions, -8 deletions)

View changed files

📝 crates/horizon-client/src/arrows.rs (+2 -2)
📝 crates/horizon-client/src/entities.rs (+12 -2)
📝 crates/horizon-client/src/entities/fluids.rs (+1 -0)
📝 crates/horizon-client/src/entity_nbt.rs (+34 -1)
📝 crates/horizon-client/src/game.rs (+2 -0)
📝 crates/horizon-client/src/game/boats.rs (+5 -1)
📝 crates/horizon-client/src/game/commands.rs (+1 -0)
📝 crates/horizon-client/src/game/machines.rs (+1 -0)
📝 crates/horizon-client/src/game/minecarts.rs (+7 -1)
📝 crates/horizon-client/src/game/persist.rs (+2 -0)
📝 crates/horizon-client/src/game/pickups.rs (+1 -0)
📝 crates/horizon-client/src/game/remote.rs (+2 -0)
📝 crates/horizon-client/src/game/remote_projectiles.rs (+1 -0)
📝 crates/horizon-client/src/game/tnt.rs (+9 -1)

📄 Description

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

What and why

NoGravity:1b was ignored by several entity kinds that Horizon moves with their own gravity code: arrows, experience orbs, primed TNT, dropped items, boats and minecarts all fell when summoned with NoGravity:1b. Thrown items, tridents, spectral arrows, falling blocks, llama spit and shulker bullets already honoured it. Arrows, experience orbs and fireballs also did not report NoGravity in /data get entity, so the flag was lost on save.

Changed: a no_gravity flag on experience orbs, dropped items, primed TNT, boats and minecarts, read from the saved entity (NoGravity) and checked where each kind applies gravity; arrows already had the flag but their flight code and loader skipped it. Arrows, orbs and fireballs now write NoGravity when set, like Entity.saveWithoutId.

Fixes #6479

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.isNoGravity, Entity.getGravity (0 with NoGravity), Entity.applyGravity (called by ExperienceOrb.tick, ItemEntity.tick, PrimedTnt.tick, AbstractArrow.tick, ThrowableProjectile.tick, FallingBlockEntity.tick, LlamaSpit.tick, ShulkerBullet.tick, AbstractMinecart.applyGravity), AbstractBoat.floatBoat (-getGravity()), Entity.saveWithoutId (writes NoGravity only when set). Checked on the shipped bytecode with tools/rea_vanilla.py callers.

Test

no_gravity_survives_save_and_load_for_orbs (entity_nbt.rs): an orb loaded with NoGravity:1b keeps it through save and load, and writes nothing when it is off.

Numbers

Side-by-side nograv scene (dedicated servers, each kind summoned at y 110 with NoGravity:1b and zero motion, Pos y after 20 ticks):

kind vanilla Horizon before Horizon after
arrow 110.0 101.05 110.0
experience_orb 110.0 104.43 110.0
tnt 110.0 102.57 110.0
item 110.0 102.57 110.0
oak_boat 110.0 101.6 110.0
minecart 110.0 103.75 110.0

NoGravity in data get entity: arrow, experience_orb, fireball and small_fireball were missing before and match vanilla (1b) after. Spectral arrow, trident, snowball, egg, ender pearl, splash potion, experience bottle, falling block, llama spit and shulker bullet matched before and after. 72 of 76 probed values match after.

What wasn't compared

  • wind_charge does not exist after /summon on Horizon (separate gap, not touched).
  • /data merge entity and reload go through the same loader as /summon; only summon and the save/load unit test were run, not a merge.
  • Vanilla's scene does not move anything (that is the point of NoGravity); the "something moves" half is the unfixed Horizon column.
  • Client-side prediction of a ridden boat was not changed.

Proved by script against the real 26.3 server; no human played this change.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick on Valhalla, against origin/main at dd289c890, 3 min 25 s)

Check Result
Scope ✅ 14 files, +80 −8
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 594 passed (29 s)
rustfmt ✅ (8 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 30 s)
tests: horizon-client, horizon-client-lib ✅ 1910 passed (1 min 14 s)
doc tests ✅ 0 passed (4 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
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/6481 **Author:** [@HrafnaValkyrja](https://github.com/HrafnaValkyrja) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/nogravity-entities` --- ### 📝 Commits (1) - [`50583c8`](https://github.com/horizon-rust/horizon/commit/50583c8b5397f4bb1a661ecc9139c77d227be727) Honour NoGravity on arrows, orbs, TNT, items, boats and minecarts ### 📊 Changes **14 files changed** (+80 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/arrows.rs` (+2 -2) 📝 `crates/horizon-client/src/entities.rs` (+12 -2) 📝 `crates/horizon-client/src/entities/fluids.rs` (+1 -0) 📝 `crates/horizon-client/src/entity_nbt.rs` (+34 -1) 📝 `crates/horizon-client/src/game.rs` (+2 -0) 📝 `crates/horizon-client/src/game/boats.rs` (+5 -1) 📝 `crates/horizon-client/src/game/commands.rs` (+1 -0) 📝 `crates/horizon-client/src/game/machines.rs` (+1 -0) 📝 `crates/horizon-client/src/game/minecarts.rs` (+7 -1) 📝 `crates/horizon-client/src/game/persist.rs` (+2 -0) 📝 `crates/horizon-client/src/game/pickups.rs` (+1 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+2 -0) 📝 `crates/horizon-client/src/game/remote_projectiles.rs` (+1 -0) 📝 `crates/horizon-client/src/game/tnt.rs` (+9 -1) </details> ### 📄 Description > 🤖 Opened by Valkyrie's AI agent (Claude Code, Opus 5.5), not by Valkyrie herself. ## What and why `NoGravity:1b` was ignored by several entity kinds that Horizon moves with their own gravity code: arrows, experience orbs, primed TNT, dropped items, boats and minecarts all fell when summoned with `NoGravity:1b`. Thrown items, tridents, spectral arrows, falling blocks, llama spit and shulker bullets already honoured it. Arrows, experience orbs and fireballs also did not report `NoGravity` in `/data get entity`, so the flag was lost on save. Changed: a `no_gravity` flag on experience orbs, dropped items, primed TNT, boats and minecarts, read from the saved entity (`NoGravity`) and checked where each kind applies gravity; arrows already had the flag but their flight code and loader skipped it. Arrows, orbs and fireballs now write `NoGravity` when set, like `Entity.saveWithoutId`. Fixes #6479 ## 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 `Entity.isNoGravity`, `Entity.getGravity` (0 with `NoGravity`), `Entity.applyGravity` (called by `ExperienceOrb.tick`, `ItemEntity.tick`, `PrimedTnt.tick`, `AbstractArrow.tick`, `ThrowableProjectile.tick`, `FallingBlockEntity.tick`, `LlamaSpit.tick`, `ShulkerBullet.tick`, `AbstractMinecart.applyGravity`), `AbstractBoat.floatBoat` (`-getGravity()`), `Entity.saveWithoutId` (writes `NoGravity` only when set). Checked on the shipped bytecode with `tools/rea_vanilla.py callers`. ## Test `no_gravity_survives_save_and_load_for_orbs` (`entity_nbt.rs`): an orb loaded with `NoGravity:1b` keeps it through save and load, and writes nothing when it is off. ## Numbers Side-by-side `nograv` scene (dedicated servers, each kind summoned at y 110 with `NoGravity:1b` and zero motion, Pos y after 20 ticks): | kind | vanilla | Horizon before | Horizon after | |---|---|---|---| | arrow | 110.0 | 101.05 | 110.0 | | experience_orb | 110.0 | 104.43 | 110.0 | | tnt | 110.0 | 102.57 | 110.0 | | item | 110.0 | 102.57 | 110.0 | | oak_boat | 110.0 | 101.6 | 110.0 | | minecart | 110.0 | 103.75 | 110.0 | `NoGravity` in `data get entity`: arrow, experience_orb, fireball and small_fireball were missing before and match vanilla (1b) after. Spectral arrow, trident, snowball, egg, ender pearl, splash potion, experience bottle, falling block, llama spit and shulker bullet matched before and after. 72 of 76 probed values match after. ## What wasn't compared - `wind_charge` does not exist after `/summon` on Horizon (separate gap, not touched). - `/data merge entity` and reload go through the same loader as `/summon`; only summon and the save/load unit test were run, not a merge. - Vanilla's scene does not move anything (that is the point of `NoGravity`); the "something moves" half is the unfixed Horizon column. - Client-side prediction of a ridden boat was not changed. Proved by script against the real 26.3 server; no human played this change. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on Valhalla, against origin/main at dd289c890, 3 min 25 s) | Check | Result | | --- | --- | | Scope | ✅ 14 files, +80 −8 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 594 passed (29 s) | | rustfmt | ✅ (8 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 30 s) | | tests: horizon-client, horizon-client-lib | ✅ 1910 passed (1 min 14 s) | | doc tests | ✅ 0 passed (4 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | 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>
bsakaguchi 2026-11-03 06:28:52 +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#6905
No description provided.