[PR #2685] [MERGED] Send more mob state to the single player window: sleep, graze, rear, invisible, swim, shakes, wither heads #4539

Closed
opened 2026-11-03 04:17:54 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2685
Author: @kacpherek
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: fix/mob-state-sync-3


📝 Commits (4)

  • cece5ac Send more mob state to the single player window
  • 74da2fe Merge main into fix/mob-state-sync-3
  • 0f8f8fc Merge main into fix/mob-state-sync-3
  • 1cfb4de Merge main into fix/mob-state-sync-3

📊 Changes

14 files changed (+351 additions, -25 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+3 -1)
📝 crates/horizon-client/src/game/lan.rs (+107 -8)
📝 crates/horizon-client/src/game/remote.rs (+48 -2)
📝 crates/horizon-client/src/game/remote_mob_data.rs (+65 -2)
📝 crates/horizon-client/src/mobs/ai.rs (+3 -0)
📝 crates/horizon-client/src/mobs/anim.rs (+23 -0)
📝 crates/horizon-client/src/mobs/equine.rs (+21 -0)
📝 crates/horizon-client/src/mobs/illusioner.rs (+9 -0)
📝 crates/horizon-client/src/mobs/piglin.rs (+7 -0)
📝 crates/horizon-client/src/mobs/render.rs (+11 -0)
📝 crates/horizon-client/src/mobs/sync.rs (+7 -2)
📝 crates/horizon-client/src/mobs/undead.rs (+11 -0)
📝 crates/horizon-client/src/mobs/wither.rs (+28 -10)
📝 crates/horizon-client/src/mobs/zombie_villager.rs (+8 -0)

📄 Description

This builds on #2528: it adds to its mobs/sync.rs helpers and pose sync, so the diff here shows #2528's two commits until that one merges. Only the top commit is new.

What and why

On the single player server thread (and on a LAN or dedicated server) a client only draws what the server sends. These mob states were computed on the server but never sent, or sent and never read, so the window drew them wrong:

  • Sleeping villagers lay upright. The server now sends the sleeping pose and the bed position (index 14); the client lies the villager in the bed the way the bed faces.
  • Horses never grazed or reared. Flags 16 (eating) and 32 (standing) of AbstractHorse now go out and drive the existing animation, which also runs on the client (equine::client_tick).
  • Invisible mobs were drawn. Shared flag 0x20 is now sent (from Invisible or the effect) and hides the model; an invisible illusioner shows its mirror images, which move on the client like in vanilla. Players are left alone.
  • An enderman's carried block (index 16) was sent but not read, so the block never showed. It is read now, and clearing it is sent.
  • Drowned never swam. The server tracks Drowned.setSwimming (shared flag 0x10), the client eases the swim amount, and the drowned model and renderer follow DrownedModel.setupSwimAnimation and DrownedRenderer.setupRotations.
  • Zombie villager cures did not shake (DATA_CONVERTING_ID), zombies and husks did not shake when turning into drowned or zombies (DATA_DROWNED_CONVERSION_ID), and hoglins and piglins did not shake outside the Nether. The first two are sent; for the last one the immunity flag is sent and the client works out isConverting from the dimension, as vanilla does.
  • Villagers and wandering traders never shook their head to say no (DATA_UNHAPPY_COUNTER). It is sent and read now.
  • A charged blaze showed no flames. DATA_FLAGS_ID is sent and Blaze.isOnFire draws the flames.
  • Turtles never looked pregnant or laying. HAS_EGG and LAYING_EGG are sent and read.
  • Baby zoglins were drawn as adults. Zoglin's baby flag is now sent.
  • A wither's side heads never aimed on a client. DATA_TARGET_B and DATA_TARGET_C are sent and the client turns the heads toward those entities. The server also checks line of sight before a side head shoots, like vanilla.

Not done: a villager showing a trade item in its hand (ShowTradesToPlayer). That goal only runs for the local player in the mob world, which the server thread does not have, so it needs that fixed first. The enderman open mouth is #2653's.

Vanilla reference

  • LivingEntity.startSleeping, Entity.DATA_POSE, LivingEntity.DATA_SLEEPING_POS_ID
  • AbstractHorse flags and tick (eat, stand, mouth animation)
  • Entity.DATA_SHARED_FLAGS_ID (swimming, invisible), Drowned.updateSwimming, Drowned.isVisuallySwimming, DrownedModel.setupSwimAnimation, DrownedRenderer.setupRotations
  • EnderMan.DATA_CARRY_STATE
  • ZombieVillager.DATA_CONVERTING_ID, Zombie.DATA_DROWNED_CONVERSION_ID, Hoglin.isConverting, AbstractPiglin.isConverting
  • AbstractVillager.DATA_UNHAPPY_COUNTER
  • Blaze.isOnFire
  • Turtle.HAS_EGG, Turtle.LAYING_EGG
  • Zoglin.DATA_BABY_ID
  • WitherBoss.aiStep (head turning), WitherBoss.customServerAiStep (hasLineOfSight)

Self-check

cargo check -p horizon-client passes.


🔄 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/2685 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/mob-state-sync-3` --- ### 📝 Commits (4) - [`cece5ac`](https://github.com/horizon-rust/horizon/commit/cece5aca30e032ffb68897297bc2533459d99073) Send more mob state to the single player window - [`74da2fe`](https://github.com/horizon-rust/horizon/commit/74da2fe6b7cbd049bfecbf5db24e68530b148ffe) Merge main into fix/mob-state-sync-3 - [`0f8f8fc`](https://github.com/horizon-rust/horizon/commit/0f8f8fce11d4016f656f66c8d26dd159d9aa6962) Merge main into fix/mob-state-sync-3 - [`1cfb4de`](https://github.com/horizon-rust/horizon/commit/1cfb4def89185cad04509e3828f2025aa560919b) Merge main into fix/mob-state-sync-3 ### 📊 Changes **14 files changed** (+351 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+3 -1) 📝 `crates/horizon-client/src/game/lan.rs` (+107 -8) 📝 `crates/horizon-client/src/game/remote.rs` (+48 -2) 📝 `crates/horizon-client/src/game/remote_mob_data.rs` (+65 -2) 📝 `crates/horizon-client/src/mobs/ai.rs` (+3 -0) 📝 `crates/horizon-client/src/mobs/anim.rs` (+23 -0) 📝 `crates/horizon-client/src/mobs/equine.rs` (+21 -0) 📝 `crates/horizon-client/src/mobs/illusioner.rs` (+9 -0) 📝 `crates/horizon-client/src/mobs/piglin.rs` (+7 -0) 📝 `crates/horizon-client/src/mobs/render.rs` (+11 -0) 📝 `crates/horizon-client/src/mobs/sync.rs` (+7 -2) 📝 `crates/horizon-client/src/mobs/undead.rs` (+11 -0) 📝 `crates/horizon-client/src/mobs/wither.rs` (+28 -10) 📝 `crates/horizon-client/src/mobs/zombie_villager.rs` (+8 -0) </details> ### 📄 Description This builds on #2528: it adds to its `mobs/sync.rs` helpers and pose sync, so the diff here shows #2528's two commits until that one merges. Only the top commit is new. ## What and why On the single player server thread (and on a LAN or dedicated server) a client only draws what the server sends. These mob states were computed on the server but never sent, or sent and never read, so the window drew them wrong: - Sleeping villagers lay upright. The server now sends the sleeping pose and the bed position (index 14); the client lies the villager in the bed the way the bed faces. - Horses never grazed or reared. Flags 16 (eating) and 32 (standing) of `AbstractHorse` now go out and drive the existing animation, which also runs on the client (`equine::client_tick`). - Invisible mobs were drawn. Shared flag 0x20 is now sent (from `Invisible` or the effect) and hides the model; an invisible illusioner shows its mirror images, which move on the client like in vanilla. Players are left alone. - An enderman's carried block (index 16) was sent but not read, so the block never showed. It is read now, and clearing it is sent. - Drowned never swam. The server tracks `Drowned.setSwimming` (shared flag 0x10), the client eases the swim amount, and the drowned model and renderer follow `DrownedModel.setupSwimAnimation` and `DrownedRenderer.setupRotations`. - Zombie villager cures did not shake (`DATA_CONVERTING_ID`), zombies and husks did not shake when turning into drowned or zombies (`DATA_DROWNED_CONVERSION_ID`), and hoglins and piglins did not shake outside the Nether. The first two are sent; for the last one the immunity flag is sent and the client works out `isConverting` from the dimension, as vanilla does. - Villagers and wandering traders never shook their head to say no (`DATA_UNHAPPY_COUNTER`). It is sent and read now. - A charged blaze showed no flames. `DATA_FLAGS_ID` is sent and `Blaze.isOnFire` draws the flames. - Turtles never looked pregnant or laying. `HAS_EGG` and `LAYING_EGG` are sent and read. - Baby zoglins were drawn as adults. Zoglin's baby flag is now sent. - A wither's side heads never aimed on a client. `DATA_TARGET_B` and `DATA_TARGET_C` are sent and the client turns the heads toward those entities. The server also checks line of sight before a side head shoots, like vanilla. Not done: a villager showing a trade item in its hand (`ShowTradesToPlayer`). That goal only runs for the local player in the mob world, which the server thread does not have, so it needs that fixed first. The enderman open mouth is #2653's. ## Vanilla reference - `LivingEntity.startSleeping`, `Entity.DATA_POSE`, `LivingEntity.DATA_SLEEPING_POS_ID` - `AbstractHorse` flags and `tick` (eat, stand, mouth animation) - `Entity.DATA_SHARED_FLAGS_ID` (swimming, invisible), `Drowned.updateSwimming`, `Drowned.isVisuallySwimming`, `DrownedModel.setupSwimAnimation`, `DrownedRenderer.setupRotations` - `EnderMan.DATA_CARRY_STATE` - `ZombieVillager.DATA_CONVERTING_ID`, `Zombie.DATA_DROWNED_CONVERSION_ID`, `Hoglin.isConverting`, `AbstractPiglin.isConverting` - `AbstractVillager.DATA_UNHAPPY_COUNTER` - `Blaze.isOnFire` - `Turtle.HAS_EGG`, `Turtle.LAYING_EGG` - `Zoglin.DATA_BABY_ID` - `WitherBoss.aiStep` (head turning), `WitherBoss.customServerAiStep` (`hasLineOfSight`) ## Self-check `cargo check -p horizon-client` passes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:17:54 +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#4539
No description provided.