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

A server sent its clients only mobs and dropped items. Boats, every kind of
minecart, armor stands, item frames, paintings and the entities Horizon keeps
without simulating are now tracked as ServerEntity does: the AddEntity data
(hanging entities at their block, with their direction), the synched data that
differs from the defaults, equipment, passengers (ClientboundSetPassengersPacket
at pairing and on change; a passenger syncs only its rotation and resyncs its
position when it dismounts), and the type's update interval and range.

Also vanilla-exact on the way, as the new harness found:
- mobs pair with their health (always non-default) and Mob flags (no AI, left-handed);
- /summon without NBT summons any type from an empty compound;
- armor stands move before gravity (LivingEntity.travelInAir), so a stand at rest
  keeps vanilla's -0.0784 vertical motion.

tools/test_server_entities_parity.py compares, from a vanilla-codec client, what
vanilla's dedicated server and Horizon's track for a scene of 20 entities.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-17 21:57:33 +02:00
parent ce571f789c
commit 43e8b54918
12 changed files with 811 additions and 65 deletions
@@ -590,6 +590,10 @@ packet!(SetCursorItem { item: Option<Stack> => Slot });
packet!(SetDefaultSpawnPosition { pos: GlobalPos => GlobalPos, yaw: f32 => Float, pitch: f32 => Float });
packet!(SetEntityData { id: i32 => VarInt, values: Vec<(u8, i32, Value)> => EntityData });
packet!(SetEntityMotion { id: i32 => VarInt, velocity: [f64; 3] => LpVec3 });
packet!(
/// ClientboundSetPassengersPacket: a vehicle and every entity riding it.
SetPassengers { vehicle: i32 => VarInt, passengers: Vec<i32> => List<VarInt> }
);
/// ClientboundSetEquipmentPacket: (EquipmentSlot ordinal, stack) pairs.
pub struct Equipment;
impl Codec<Vec<(u8, Option<Stack>)>> for Equipment {
@@ -1426,6 +1430,7 @@ packet_enum!(Clientbound, crate::ids::play::clientbound {
SetHealth(SetHealth) = SET_HEALTH,
SetHeldSlot(SetHeldSlot) = SET_HELD_SLOT,
SetObjective(SetObjective) = SET_OBJECTIVE,
SetPassengers(SetPassengers) = SET_PASSENGERS,
SetPlayerInventory(SetPlayerInventory) = SET_PLAYER_INVENTORY,
SetPlayerTeam(SetPlayerTeam) = SET_PLAYER_TEAM,
SetScore(SetScore) = SET_SCORE,
@@ -2052,6 +2057,10 @@ mod tests {
id: 2,
velocity: [0.0; 3],
}),
Clientbound::SetPassengers(SetPassengers {
vehicle: 2,
passengers: vec![3, 300],
}),
Clientbound::SetEquipment(SetEquipment {
id: 2,
slots: vec![(0, None), (5, Some(Stack::new(1, 1)))],