[PR #1802] [MERGED] Server clients see mobs' aggression and arm swings #3773

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

📋 Pull Request Information

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

Base: main ← Head: fix/mob-flags-and-swings


📝 Commits (1)

  • 68deac8 Server clients see mobs' aggression and arm swings

📊 Changes

3 files changed (+40 additions, -14 deletions)

View changed files

📝 crates/horizon-client/src/game/lan.rs (+19 -5)
📝 crates/horizon-client/src/game/remote.rs (+0 -9)
📝 crates/horizon-client/src/game/remote_mob_data.rs (+21 -0)

📄 Description

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

What the player reported

.dezerx on Discord (#horizon-bugs, 2026-10-25, single player): vindicators hold nothing, skeletons never draw their bow, piglins and wither skeletons don't animate, and "all mobs holding an item don't have an animation when hitting".

Cause

On a server's client (single player on the server thread since #1514, LAN guests, dedicated servers):

  • the server's mob_meta sent Mob.DATA_MOB_FLAGS_ID (15) without the aggressive bit, and only when non-zero (no default, so a flag never went back off); the client read entry 15 only for rabbits, and only its no-AI bit. Mob.isAggressive is what draws the vindicator's axe, a skeleton's or illusioner's drawn bow, a piglin's raised weapon or held crossbow, the pillager's and illagers' attack poses, a drowned's raised trident and the zombie arms;
  • mobs' arm swings never reached clients: lan_swings sends the players' only.

Vanilla rule

  • Mob.DATA_MOB_FLAGS_ID: byte, no AI 1, left-handed 2, aggressive 4 (Mob.setAggressive), defined as 0.
  • LivingEntity.swing on a server sends ClientboundSwingAnimationPacket to the players tracking the entity (MeleeAttackGoal, MeleeAttack and the other attack behaviours swing before doHurtTarget).

Change

  • game/lan.rs: the aggressive bit goes in entry 15, with its default 0; a mob's swing started (or restarted) since the last flush is sent as a swing of its main hand (Hub::swing), detected from its swing time kept beside its hurt time.
  • game/remote_mob_data.rs: every mob takes no AI, left-handed and aggressive from entry 15 (the rabbit-only reader in remote.rs is gone).

Tested

  • Server thread (default single player), survival at noon, /summon vindicator, skeleton, wither_skeleton, piglin: the vindicator raises its axe as it attacks (on main its hands stay crossed and empty), the skeleton draws its bow, the wither skeleton and piglin swing as they hit.
  • LAN guests and dedicated servers get the same entity data and packets (lan_entities, lan_flush_effects). --in-frame doesn't use them: unchanged.
  • Unit test mob_flags_turn_aggression_on_and_off (client: entry 15 turns the vindicator's axe on and back off).
  • Harnesses (local): dedicated_server PASS, server_entities PASS.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 6a065fa48, 4 min 44 s)

Check Result
Scope ✅ 3 files, +40 −14
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (6 s)
clippy ✅ (32 s)
tests: horizon-client ✅ 1237 passed (3 min 32 s)
doc tests ✅ 0 passed (2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 27 affected, to run in CI (--quick): arrow, block_removal, command_exec, composter, crafter, dedicated_server, dispenser, interaction_input, locator_bar, mace, online_mode, player_sync and 15 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Not here (same report, next PRs): crossbow charging poses (they also need the mob's item-use flags, entry 8), enderman / shulker / witch / evoker data, mob entity events (iron golem, warden, ravager attacks).

🤖 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/1802 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/mob-flags-and-swings` --- ### 📝 Commits (1) - [`68deac8`](https://github.com/horizon-rust/horizon/commit/68deac8533c0a7072785712940b643f11c34c039) Server clients see mobs' aggression and arm swings ### 📊 Changes **3 files changed** (+40 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan.rs` (+19 -5) 📝 `crates/horizon-client/src/game/remote.rs` (+0 -9) 📝 `crates/horizon-client/src/game/remote_mob_data.rs` (+21 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What the player reported .dezerx on Discord (#horizon-bugs, 2026-10-25, single player): vindicators hold nothing, skeletons never draw their bow, piglins and wither skeletons don't animate, and "all mobs holding an item don't have an animation when hitting". ## Cause On a server's client (single player on the server thread since #1514, LAN guests, dedicated servers): - the server's `mob_meta` sent `Mob.DATA_MOB_FLAGS_ID` (15) without the aggressive bit, and only when non-zero (no default, so a flag never went back off); the client read entry 15 only for rabbits, and only its no-AI bit. `Mob.isAggressive` is what draws the vindicator's axe, a skeleton's or illusioner's drawn bow, a piglin's raised weapon or held crossbow, the pillager's and illagers' attack poses, a drowned's raised trident and the zombie arms; - mobs' arm swings never reached clients: `lan_swings` sends the players' only. ## Vanilla rule - `Mob.DATA_MOB_FLAGS_ID`: byte, no AI 1, left-handed 2, aggressive 4 (`Mob.setAggressive`), defined as 0. - `LivingEntity.swing` on a server sends `ClientboundSwingAnimationPacket` to the players tracking the entity (`MeleeAttackGoal`, `MeleeAttack` and the other attack behaviours swing before `doHurtTarget`). ## Change - `game/lan.rs`: the aggressive bit goes in entry 15, with its default 0; a mob's swing started (or restarted) since the last flush is sent as a swing of its main hand (`Hub::swing`), detected from its swing time kept beside its hurt time. - `game/remote_mob_data.rs`: every mob takes no AI, left-handed and aggressive from entry 15 (the rabbit-only reader in remote.rs is gone). ## Tested - Server thread (default single player), survival at noon, `/summon vindicator`, `skeleton`, `wither_skeleton`, `piglin`: the vindicator raises its axe as it attacks (on main its hands stay crossed and empty), the skeleton draws its bow, the wither skeleton and piglin swing as they hit. - LAN guests and dedicated servers get the same entity data and packets (`lan_entities`, `lan_flush_effects`). `--in-frame` doesn't use them: unchanged. - Unit test `mob_flags_turn_aggression_on_and_off` (client: entry 15 turns the vindicator's axe on and back off). - Harnesses (local): dedicated_server PASS, server_entities PASS. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 6a065fa48, 4 min 44 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +40 −14 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (6 s) | | clippy | ✅ (32 s) | | tests: horizon-client | ✅ 1237 passed (3 min 32 s) | | doc tests | ✅ 0 passed (2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 27 affected, to run in CI (--quick): arrow, block_removal, command_exec, composter, crafter, dedicated_server, dispenser, interaction_input, locator_bar, mace, online_mode, player_sync and 15 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Not here (same report, next PRs): crossbow charging poses (they also need the mob's item-use flags, entry 8), enderman / shulker / witch / evoker data, mob entity events (iron golem, warden, ravager attacks). 🤖 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-03 04:12:12 +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#3773
No description provided.