[PR #759] [MERGED] Server: track boats, minecarts, armor stands, frames and paintings to clients #2789

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

📋 Pull Request Information

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

Base: main ← Head: fix/server-entity-tracking


📝 Commits (1)

  • 43e8b54 Server: track boats, minecarts, armor stands, frames and paintings to clients

📊 Changes

12 files changed (+811 additions, -65 deletions)

View changed files

📝 crates/horizon-client/src/entities.rs (+10 -7)
📝 crates/horizon-client/src/game.rs (+1 -0)
📝 crates/horizon-client/src/game/commands.rs (+7 -1)
📝 crates/horizon-client/src/game/lan.rs (+12 -6)
➕ crates/horizon-client/src/game/lan_entities.rs (+259 -0)
📝 crates/horizon-client/src/game/minecarts.rs (+4 -0)
📝 crates/horizon-client/src/lan/entity.rs (+136 -47)
📝 crates/horizon-client/src/lan/hub.rs (+5 -2)
📝 crates/horizon-protocol/src/packets/play.rs (+9 -0)
➕ mods/horizon/src/test/java/dev/horizonlab/parity/EntityTranscript.java (+160 -0)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaProtocolClient.java (+34 -2)
➕ tools/test_server_entities_parity.py (+174 -0)

📄 Description

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

What

A Horizon server (dedicated, LAN host, single player's server thread) now tracks boats, minecarts, armor stands, item frames, paintings and the entities it keeps without simulating them to its clients, the way vanilla's ServerEntity does. Before this, it sent only mobs and dropped items, so vanilla and Horizon clients saw none of the others.

  • Spawn (getAddEntityPacket):
    • type, position and rotation;
    • item frames and paintings at their block, with their direction as the spawn data and rotation;
    • velocity.
  • Pairing data (sendPairingData), with only the values that differ from the defaults:
    • VehicleEntity hurt, hurt direction (default 1) and damage;
    • boat paddles;
    • furnace minecart fuel and the command block minecart's command;
    • armor stands: flags (small, arms, no base plate, marker), health, poses (from the Pose compound) and equipment;
    • frame direction, item and rotation;
    • painting direction and variant (a registry holder, id + 1).
  • Passengers: ClientboundSetPassengersPacket (new in horizon-protocol) when an entity is paired and when its passengers change. This covers mobs on mobs and the host in its boat or minecart. A passenger sends only its rotation and gets a full position sync once it dismounts (wasRiding).
  • Mobs: pairing now carries health whenever it isn't 1 (as for every LivingEntity) and the Mob flags (NoAI, left-handed) for every mob, not just rabbits.
  • /summon of a type without its own branch (boats, other minecarts and so on) goes through the NBT path, as SummonCommand.createEntity does.
  • ArmorStand::tick applies gravity after the move, as LivingEntity.travelInAir does. On the ground, its motion is -0.0784, like vanilla's.

Why

This is server-host-5's blocker: on a Horizon server, players couldn't see minecarts, boats, armor stands, frames or paintings. It also unblocks #731's world_reopen: with the server thread on by default, the summoned minecart never reached the window. With this change it is sent to the window's client, and #731's status already lists the carts it was sent.

How tested

New harness tools/test_server_entities_parity.py:

  • A vanilla dedicated server and Horizon's each serve the same flat world.
  • A vanilla-codec client (VanillaProtocolClient entity mode, new EntityTranscript) asks for the scene. The console freezes the ticks and summons:
    • every minecart kind, one rolling on a rail;
    • a command block minecart with a command;
    • boats and a raft, one falling;
    • armor stands: one rotated, one falling, one small/posed with arms, no base plate and a helmet;
    • a chicken jockey (passengers);
    • an item frame holding a turned diamond and a glow item frame;
    • two paintings.
  • The client records for 20 seconds what ClientPacketListener would make of the packets: spawn packet, pairing data, all data since, equipment, passengers, and where position syncs leave each entity.
  • Result: server entities: 20 entities identical. Before this PR, Horizon sent none of the 18 objects.
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::                             18 passed
cargo test -p horizon-client --bin horizon-client lan_entities       2 passed
cargo test -p horizon-client --lib entities                          5 passed
tools/test_server_entities_parity.py                                 20 entities identical
tools/parity.py --changed origin/main                                90 passed, 0 failed

Not covered yet (follow-up PRs)

  • ClientboundUpdateAttributesPacket isn't sent, for mobs either. The harness leaves attributes out.
  • Horizon tracks entities after they tick, one tick later than vanilla. The harness freezes the ticks while it summons.
  • Entities without an id in Horizon: primed TNT, falling blocks, projectiles, tridents, fireworks and end crystals. Next PR.
  • XP orbs are left to #724.
  • Horizon clients showing these objects: next PR (stacked on this one).

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/759 **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-entity-tracking` --- ### 📝 Commits (1) - [`43e8b54`](https://github.com/horizon-rust/horizon/commit/43e8b54918739c858df6a14cd7a9e6c4baf2c6bb) Server: track boats, minecarts, armor stands, frames and paintings to clients ### 📊 Changes **12 files changed** (+811 additions, -65 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entities.rs` (+10 -7) 📝 `crates/horizon-client/src/game.rs` (+1 -0) 📝 `crates/horizon-client/src/game/commands.rs` (+7 -1) 📝 `crates/horizon-client/src/game/lan.rs` (+12 -6) ➕ `crates/horizon-client/src/game/lan_entities.rs` (+259 -0) 📝 `crates/horizon-client/src/game/minecarts.rs` (+4 -0) 📝 `crates/horizon-client/src/lan/entity.rs` (+136 -47) 📝 `crates/horizon-client/src/lan/hub.rs` (+5 -2) 📝 `crates/horizon-protocol/src/packets/play.rs` (+9 -0) ➕ `mods/horizon/src/test/java/dev/horizonlab/parity/EntityTranscript.java` (+160 -0) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaProtocolClient.java` (+34 -2) ➕ `tools/test_server_entities_parity.py` (+174 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What A Horizon server (dedicated, LAN host, single player's server thread) now tracks boats, minecarts, armor stands, item frames, paintings and the entities it keeps without simulating them to its clients, the way vanilla's `ServerEntity` does. Before this, it sent only mobs and dropped items, so vanilla and Horizon clients saw none of the others. - **Spawn** (`getAddEntityPacket`): - type, position and rotation; - item frames and paintings at their block, with their direction as the spawn data and rotation; - velocity. - **Pairing data** (`sendPairingData`), with only the values that differ from the defaults: - `VehicleEntity` hurt, hurt direction (default 1) and damage; - boat paddles; - furnace minecart fuel and the command block minecart's command; - armor stands: flags (small, arms, no base plate, marker), health, poses (from the `Pose` compound) and equipment; - frame direction, item and rotation; - painting direction and variant (a registry holder, id + 1). - **Passengers:** `ClientboundSetPassengersPacket` (new in horizon-protocol) when an entity is paired and when its passengers change. This covers mobs on mobs and the host in its boat or minecart. A passenger sends only its rotation and gets a full position sync once it dismounts (`wasRiding`). - **Mobs:** pairing now carries health whenever it isn't 1 (as for every `LivingEntity`) and the `Mob` flags (NoAI, left-handed) for every mob, not just rabbits. - `/summon` of a type without its own branch (boats, other minecarts and so on) goes through the NBT path, as `SummonCommand.createEntity` does. - `ArmorStand::tick` applies gravity after the move, as `LivingEntity.travelInAir` does. On the ground, its motion is -0.0784, like vanilla's. ## Why This is server-host-5's blocker: on a Horizon server, players couldn't see minecarts, boats, armor stands, frames or paintings. It also unblocks #731's `world_reopen`: with the server thread on by default, the summoned minecart never reached the window. With this change it is sent to the window's client, and #731's `status` already lists the carts it was sent. ## How tested New harness `tools/test_server_entities_parity.py`: - A vanilla dedicated server and Horizon's each serve the same flat world. - A vanilla-codec client (`VanillaProtocolClient` entity mode, new `EntityTranscript`) asks for the scene. The console freezes the ticks and summons: - every minecart kind, one rolling on a rail; - a command block minecart with a command; - boats and a raft, one falling; - armor stands: one rotated, one falling, one small/posed with arms, no base plate and a helmet; - a chicken jockey (passengers); - an item frame holding a turned diamond and a glow item frame; - two paintings. - The client records for 20 seconds what `ClientPacketListener` would make of the packets: spawn packet, pairing data, all data since, equipment, passengers, and where position syncs leave each entity. - **Result: `server entities: 20 entities identical`.** Before this PR, Horizon sent none of the 18 objects. ``` 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:: 18 passed cargo test -p horizon-client --bin horizon-client lan_entities 2 passed cargo test -p horizon-client --lib entities 5 passed tools/test_server_entities_parity.py 20 entities identical tools/parity.py --changed origin/main 90 passed, 0 failed ``` ## Not covered yet (follow-up PRs) - `ClientboundUpdateAttributesPacket` isn't sent, for mobs either. The harness leaves attributes out. - Horizon tracks entities after they tick, one tick later than vanilla. The harness freezes the ticks while it summons. - Entities without an id in Horizon: primed TNT, falling blocks, projectiles, tridents, fireworks and end crystals. Next PR. - XP orbs are left to #724. - Horizon clients showing these objects: next PR (stacked on this one). ## 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:03 +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#2789
No description provided.