[PR #1565] [MERGED] Villagers show their profession, biome and level on the server thread, LAN and servers #3593

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

📋 Pull Request Information

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

Base: main ← Head: fix/remote-villager-data


📝 Commits (2)

  • f1369b4 Clients show villagers' professions, types and levels
  • afb638b lan_e2e: a guest sees villagers' types, professions, levels and new jobs

📊 Changes

3 files changed (+168 additions, -7 deletions)

View changed files

📝 crates/horizon-client/src/game/agent.rs (+15 -1)
📝 crates/horizon-client/src/game/remote_mob_data.rs (+91 -6)
📝 tools/lan_e2e.py (+62 -0)

📄 Description

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

What

Villagers keep their profession, biome clothes and level badge when you play on a server. That covers single player (it runs on its server thread by default since #1514), LAN guests and dedicated servers. Before this, every villager and zombie villager there looked like an unemployed plains villager. A villager that took a job also never changed its look.

This answers the Discord report (zekrom43, v0.2.46: "farmer villagers don't have the farmer texture… also check textures for villagers with other jobs").

Why

The server already sends Villager.DATA_VILLAGER_DATA (entry 19) and ZombieVillager.DATA_VILLAGER_DATA (entry 20) in SetEntityData. It sends them both when the villager spawns and again whenever they change (game/lan.rs mob_meta, lan/entity.rs send_dirty). The client never read them: game/remote_mob_data.rs had no arm for them. So VillagerProfessionLayer's type, profession and level layers all drew from the client's defaults: plains, none, no badge.

In-frame play draws from the local simulation, so it was unaffected. That is why the bug arrived with the server-thread default.

How

  • remote_mob_data::apply reads VillagerData (type, profession, level) as VillagerData.STREAM_CODEC sends it: the type and profession are built-in registry holders, which go over the network as ids. It maps them to the client's tables by name through the server's registries.json (Remote::builtin), so a vanilla server works too.
  • horizon-ctl entities now reports villager: {type, profession, level} for villagers and zombie villagers, as the game knows them. On a client, that is what it was sent.
  • New tools/lan_e2e.py --check villagers:
    • the host summons a desert librarian (level 3), a snow weaponsmith (level 5), a taiga cleric zombie villager and an unemployed plains villager;
    • the guest must see the same type, profession and level for each;
    • a composter is then placed beside the unemployed villager, and once it becomes a farmer on the host the guest must see it as a farmer too.

Tested

  • Unit test a_villager_takes_its_type_profession_and_level (type, profession and level; a later job change; the zombie villager's entry 20).
  • lan_e2e --check villagers:
    • the host in-frame passes (job taken after 20 ticks);
    • --server-thread passes (130 ticks);
    • with this PR's remote_mob_data.rs reverted, it fails: the guest sees {'level': 1, 'profession': 'none', 'type': 'plains'} for {'type': 'desert', 'profession': 'librarian', 'level': 3}.
  • In-game on the Mac mini (offscreen screenshots, the same villagers in each mode: farmer L2, librarian, armorer L3, desert farmer, snow weaponsmith L5, all seven types, zombie villagers, a wandering trader):
    • before: on the server thread every villager is bare and in-frame is correct;
    • after: both modes look the same and match vanilla's layers.
    • Screenshots: ~/code/horizon-parity/screenshots/villager-skins-1/ (before-*, after-*, lan-guest-*).
  • Dedicated server (horizon-client --dedicated, Horizon client joined), with console-summoned villagers:
    • the client reports the right type, profession and level for each;
    • a villager whose composter was already there becomes a farmer on the client within a second.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 535f2d2a0, 4 min 54 s)

Check Result
Scope ✅ 3 files, +168 −7
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 289 run, FAILED (errors=2) (27 s)
rustfmt ✅ (5 s)
clippy ✅ (42 s)
tests: horizon-client ✅ 1206 passed (3 min 0 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 ➖ 23 affected, to run in CI (--quick): arrow, block_removal, command_exec, composter, crafter, dedicated_server, dispenser, locator_bar, mace, online_mode, sculk, section_mesh and 11 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The two Python-test errors (test_parity_runner…test_reuses_until_an_input_or_output_changes, test_rust_parity…test_report_rejects_sources_changed_during_a_run) fail the same way on a branch without Python changes. They come from the macOS environment (java stub exit 127, the /private/var tmp symlink), not from this PR.

Parity: tools/parity.py --changed on one integration commit of both villager PRs (#1565 and #1566): 107 harnesses, 107 passed, 0 failed (16 min, Mac mini).

Needs Ludovic

Nothing to decide. Two things I found while testing; neither is fixed here:

  • On a dedicated server, a villager doesn't claim a job site placed after it spawned. It waited 150 s with empty Brain.memories. The same villager claims a composter that was already there, and in single player or on LAN it claims a new one within seconds. This is server-side POI/brain behaviour, not rendering.
  • Age in a villager's NBT is neither read nor saved (entity_nbt.rs only handles Age for category == "creature", but villagers are misc). So /summon villager ~ ~ ~ {Age:-24000} gives an adult, and a saved baby villager loads as an adult.

🤖 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/1565 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/remote-villager-data` --- ### 📝 Commits (2) - [`f1369b4`](https://github.com/horizon-rust/horizon/commit/f1369b4efeed55da5a1023c8942c88ffd8b9cc5c) Clients show villagers' professions, types and levels - [`afb638b`](https://github.com/horizon-rust/horizon/commit/afb638b81cbfdfabd9706aaeef8e8450119e1f93) lan_e2e: a guest sees villagers' types, professions, levels and new jobs ### 📊 Changes **3 files changed** (+168 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/agent.rs` (+15 -1) 📝 `crates/horizon-client/src/game/remote_mob_data.rs` (+91 -6) 📝 `tools/lan_e2e.py` (+62 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What Villagers keep their profession, biome clothes and level badge when you play on a server. That covers single player (it runs on its server thread by default since #1514), LAN guests and dedicated servers. Before this, every villager and zombie villager there looked like an unemployed plains villager. A villager that took a job also never changed its look. This answers the Discord report (zekrom43, v0.2.46: "farmer villagers don't have the farmer texture… also check textures for villagers with other jobs"). ## Why The server already sends `Villager.DATA_VILLAGER_DATA` (entry 19) and `ZombieVillager.DATA_VILLAGER_DATA` (entry 20) in SetEntityData. It sends them both when the villager spawns and again whenever they change (`game/lan.rs` `mob_meta`, `lan/entity.rs` `send_dirty`). The client never read them: `game/remote_mob_data.rs` had no arm for them. So `VillagerProfessionLayer`'s type, profession and level layers all drew from the client's defaults: plains, none, no badge. In-frame play draws from the local simulation, so it was unaffected. That is why the bug arrived with the server-thread default. ## How - `remote_mob_data::apply` reads VillagerData (type, profession, level) as `VillagerData.STREAM_CODEC` sends it: the type and profession are built-in registry holders, which go over the network as ids. It maps them to the client's tables by name through the server's `registries.json` (`Remote::builtin`), so a vanilla server works too. - `horizon-ctl entities` now reports `villager: {type, profession, level}` for villagers and zombie villagers, as the game knows them. On a client, that is what it was sent. - New `tools/lan_e2e.py --check villagers`: - the host summons a desert librarian (level 3), a snow weaponsmith (level 5), a taiga cleric zombie villager and an unemployed plains villager; - the guest must see the same type, profession and level for each; - a composter is then placed beside the unemployed villager, and once it becomes a farmer on the host the guest must see it as a farmer too. ## Tested - Unit test `a_villager_takes_its_type_profession_and_level` (type, profession and level; a later job change; the zombie villager's entry 20). - `lan_e2e --check villagers`: - the host in-frame passes (job taken after 20 ticks); - `--server-thread` passes (130 ticks); - with this PR's `remote_mob_data.rs` reverted, it fails: `the guest sees {'level': 1, 'profession': 'none', 'type': 'plains'} for {'type': 'desert', 'profession': 'librarian', 'level': 3}`. - In-game on the Mac mini (offscreen screenshots, the same villagers in each mode: farmer L2, librarian, armorer L3, desert farmer, snow weaponsmith L5, all seven types, zombie villagers, a wandering trader): - before: on the server thread every villager is bare and in-frame is correct; - after: both modes look the same and match vanilla's layers. - Screenshots: `~/code/horizon-parity/screenshots/villager-skins-1/` (`before-*`, `after-*`, `lan-guest-*`). - Dedicated server (`horizon-client --dedicated`, Horizon client joined), with console-summoned villagers: - the client reports the right type, profession and level for each; - a villager whose composter was already there becomes a farmer on the client within a second. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 535f2d2a0, 4 min 54 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +168 −7 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 289 run, FAILED (errors=2) (27 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (42 s) | | tests: horizon-client | ✅ 1206 passed (3 min 0 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 | ➖ 23 affected, to run in CI (--quick): arrow, block_removal, command_exec, composter, crafter, dedicated_server, dispenser, locator_bar, mace, online_mode, sculk, section_mesh and 11 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The two Python-test errors (`test_parity_runner…test_reuses_until_an_input_or_output_changes`, `test_rust_parity…test_report_rejects_sources_changed_during_a_run`) fail the same way on a branch without Python changes. They come from the macOS environment (`java` stub exit 127, the `/private/var` tmp symlink), not from this PR. Parity: `tools/parity.py --changed` on one integration commit of both villager PRs (#1565 and #1566): **107 harnesses, 107 passed, 0 failed** (16 min, Mac mini). ## Needs Ludovic Nothing to decide. Two things I found while testing; neither is fixed here: - On a **dedicated server**, a villager doesn't claim a job site placed after it spawned. It waited 150 s with empty `Brain.memories`. The same villager claims a composter that was already there, and in single player or on LAN it claims a new one within seconds. This is server-side POI/brain behaviour, not rendering. - `Age` in a villager's NBT is neither read nor saved (`entity_nbt.rs` only handles `Age` for `category == "creature"`, but villagers are `misc`). So `/summon villager ~ ~ ~ {Age:-24000}` gives an adult, and a saved baby villager loads as an adult. 🤖 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:10:40 +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#3593
No description provided.