[PR #766] [MERGED] Server: track primed TNT, falling blocks, projectiles, tridents, fireworks and crystals #2793

Closed
opened 2026-11-02 15:59:06 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/766
Author: @ludovic111
Created: 10/17/2026
Status: ✅ Merged
Merged: 10/18/2026
Merged by: @ludovic111

Base: main ← Head: fix/server-projectiles


📝 Commits (2)

  • 866e772 Server: track primed TNT, falling blocks, projectiles, tridents, fireworks and crystals
  • 946bf84 Load summoned and saved primed TNT as live TNT; step the entity harness

📊 Changes

15 files changed (+377 additions, -29 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+3 -0)
📝 crates/horizon-client/src/game/dragon.rs (+6 -0)
📝 crates/horizon-client/src/game/fireworks.rs (+8 -5)
📝 crates/horizon-client/src/game/lan.rs (+11 -5)
📝 crates/horizon-client/src/game/lan_entities.rs (+191 -1)
📝 crates/horizon-client/src/game/persist.rs (+18 -0)
📝 crates/horizon-client/src/game/tnt.rs (+4 -0)
📝 crates/horizon-client/src/game/trident.rs (+11 -8)
📝 crates/horizon-client/src/lan/entity.rs (+94 -5)
📝 crates/horizon-client/src/lan/hub.rs (+1 -0)
📝 crates/horizon-client/src/projectiles.rs (+3 -0)
📝 crates/horizon-client/tests/lan_bot.rs (+1 -0)
📝 crates/horizon-protocol/src/packets/play.rs (+6 -0)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/EntityTranscript.java (+5 -1)
📝 tools/test_server_entities_parity.py (+15 -4)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Stacked on #760 (and #759 below it). Retarget to main once they merge.

What

These entities had no id in Horizon, so no server could send them to its clients: primed TNT, falling blocks, projectiles, tridents, firework rockets and end crystals. Each now gets an id from the entity counter before it is first tracked, and goes to clients as vanilla's ServerEntity sends it:

  • Primed TNT: its fuse (DATA_FUSE_ID, sent each tick it changes, like vanilla).
  • Falling blocks: the block state as spawn data, the start position and no gravity.
  • TNT and falling blocks send full position syncs while they touch a block (requiresPrecisePosition, new EntityState::precise).
  • Arrows and tridents: position and rotation on every update (AbstractArrow), plus:
    • flags (critical, no physics), pierce level and in-ground;
    • the trident's loyalty and foil;
    • the owner as the spawn data.
  • Fireballs, wither skulls and wind charges: their velocity is bundled with ClientboundProjectilePowerPacket (new in horizon-protocol). The power is 0.1, or 0 for wind charges.
  • Other projectiles: snowballs, eggs, pearls, llama spit, shulker bullets and splash potions.
  • Firework rockets: their item (once set from a stack), the player they boost and whether they were shot at an angle.
  • End crystals: their beam target and base.
  • /summon minecraft:tnt and primed TNT in a saved chunk now load as live primed TNT, with the fuse (80 when absent) and motion they were saved with. Before, they were an unsimulated entity.

Why

These are the rest of server-host-5's blocker. Vanilla players on a Horizon server, and single player on its server thread (#731), never saw a primed TNT, an arrow or a falling block. XP orbs are left to #724.

How tested

  • tools/test_server_entities_parity.py: the scene gains two primed TNT (one falling onto the ground), a floating falling block, an arrow that lands and an end crystal without its base.
    • It now runs a fixed 200 ticks (tick step), so a fuse still counting down ends the same on both servers.
    • Result: server entities: 25 entities identical.
  • New unit tests:
    • arrows send MoveEntityPosRot every update;
    • a fireball's velocity goes out as a bundle with its power;
    • a precise entity gets EntityPositionSync.
cargo fmt --all --check                                          ok
cargo clippy -p horizon-client -p horizon-protocol --all-targets -- -D warnings   ok
cargo test -p horizon-protocol                                    55 passed
cargo test -p horizon-client --lib lan::                          21 passed
tools/test_server_entities_parity.py                              25 entities identical
tools/parity.py --changed origin/main                             running; results follow in a comment

Not covered yet

  • Snowballs, tridents, fireballs and fireworks are tracked when the game creates them (throws, mobs, dispensers), but /summon still makes them unsimulated, so the harness can't summon them in vanilla's state. Their tracking follows the same code as the arrow's and the fireball bundle's (unit-tested).
  • A falling block that is removed mid-flight has its last sync one tick later than vanilla's. Horizon tracks entities after they tick, and vanilla tracks them before. That's why the harness's falling block floats.
  • Lightning bolts, fishing hooks and evoker fangs aren't sent yet.

Needs Ludovic

Nothing.

🤖 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/766 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/17/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/server-projectiles` --- ### 📝 Commits (2) - [`866e772`](https://github.com/horizon-rust/horizon/commit/866e772227f1440bfaa72dff5ff9834d0bb1db2e) Server: track primed TNT, falling blocks, projectiles, tridents, fireworks and crystals - [`946bf84`](https://github.com/horizon-rust/horizon/commit/946bf848189a54c2577a061f712fbf544a4e4461) Load summoned and saved primed TNT as live TNT; step the entity harness ### 📊 Changes **15 files changed** (+377 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+3 -0) 📝 `crates/horizon-client/src/game/dragon.rs` (+6 -0) 📝 `crates/horizon-client/src/game/fireworks.rs` (+8 -5) 📝 `crates/horizon-client/src/game/lan.rs` (+11 -5) 📝 `crates/horizon-client/src/game/lan_entities.rs` (+191 -1) 📝 `crates/horizon-client/src/game/persist.rs` (+18 -0) 📝 `crates/horizon-client/src/game/tnt.rs` (+4 -0) 📝 `crates/horizon-client/src/game/trident.rs` (+11 -8) 📝 `crates/horizon-client/src/lan/entity.rs` (+94 -5) 📝 `crates/horizon-client/src/lan/hub.rs` (+1 -0) 📝 `crates/horizon-client/src/projectiles.rs` (+3 -0) 📝 `crates/horizon-client/tests/lan_bot.rs` (+1 -0) 📝 `crates/horizon-protocol/src/packets/play.rs` (+6 -0) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/EntityTranscript.java` (+5 -1) 📝 `tools/test_server_entities_parity.py` (+15 -4) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Stacked on #760 (and #759 below it). Retarget to `main` once they merge. ## What These entities had no id in Horizon, so no server could send them to its clients: primed TNT, falling blocks, projectiles, tridents, firework rockets and end crystals. Each now gets an id from the entity counter before it is first tracked, and goes to clients as vanilla's `ServerEntity` sends it: - **Primed TNT:** its fuse (`DATA_FUSE_ID`, sent each tick it changes, like vanilla). - **Falling blocks:** the block state as spawn data, the start position and no gravity. - TNT and falling blocks send full position syncs while they touch a block (`requiresPrecisePosition`, new `EntityState::precise`). - **Arrows and tridents:** position and rotation on every update (`AbstractArrow`), plus: - flags (critical, no physics), pierce level and in-ground; - the trident's loyalty and foil; - the owner as the spawn data. - **Fireballs, wither skulls and wind charges:** their velocity is bundled with `ClientboundProjectilePowerPacket` (new in horizon-protocol). The power is 0.1, or 0 for wind charges. - **Other projectiles:** snowballs, eggs, pearls, llama spit, shulker bullets and splash potions. - **Firework rockets:** their item (once set from a stack), the player they boost and whether they were shot at an angle. - **End crystals:** their beam target and base. - `/summon minecraft:tnt` and primed TNT in a saved chunk now load as live primed TNT, with the fuse (80 when absent) and motion they were saved with. Before, they were an unsimulated entity. ## Why These are the rest of server-host-5's blocker. Vanilla players on a Horizon server, and single player on its server thread (#731), never saw a primed TNT, an arrow or a falling block. XP orbs are left to #724. ## How tested - `tools/test_server_entities_parity.py`: the scene gains two primed TNT (one falling onto the ground), a floating falling block, an arrow that lands and an end crystal without its base. - It now runs a fixed 200 ticks (`tick step`), so a fuse still counting down ends the same on both servers. - **Result: `server entities: 25 entities identical`.** - New unit tests: - arrows send `MoveEntityPosRot` every update; - a fireball's velocity goes out as a bundle with its power; - a precise entity gets `EntityPositionSync`. ``` cargo fmt --all --check ok cargo clippy -p horizon-client -p horizon-protocol --all-targets -- -D warnings ok cargo test -p horizon-protocol 55 passed cargo test -p horizon-client --lib lan:: 21 passed tools/test_server_entities_parity.py 25 entities identical tools/parity.py --changed origin/main running; results follow in a comment ``` ## Not covered yet - Snowballs, tridents, fireballs and fireworks are tracked when the game creates them (throws, mobs, dispensers), but `/summon` still makes them unsimulated, so the harness can't summon them in vanilla's state. Their tracking follows the same code as the arrow's and the fireball bundle's (unit-tested). - A falling block that is removed mid-flight has its last sync one tick later than vanilla's. Horizon tracks entities after they tick, and vanilla tracks them before. That's why the harness's falling block floats. - Lightning bolts, fishing hooks and evoker fangs aren't sent yet. ## Needs Ludovic Nothing. 🤖 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-02 15:59:06 +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#2793
No description provided.