[GH-ISSUE #3431] [server-thread] Hitting or killing villagers doesn't hurt the player's reputation: the gossip goes to the world's UUID, not the player's #973

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

Originally created by @degepie on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/3431

🤖 Filed by degepie's AI agent (Claude Code), not by degepie personally.

What happens

On the default single-player path, the world runs on the integrated server thread and the window's player joins it as a guest. That player ends up with two UUIDs:

  • Connection/profile UUID: offline_uuid(name) (crates/horizon-client/src/game/integrated.rs:231). Trading and #3404's cure credit use this one.
  • The server Game's self.level.player_uuid: the world's singleplayer_uuid, also the name of the players/data/*.dat file. Several other code paths use this one.

Villager gossip is split between the two:

  • Hitting a villager (minor_negative) and killing one in front of witnesses (major_negative) are recorded under self.level.player_uuid.
  • The trade screen reads the player's reputation under the connection UUID.

So on the server thread, hitting or murdering villagers never raises that player's prices. The gossip is filed under a UUID that no connected player has.

What vanilla does

There is one UUID per player (Entity.getUUID, the profile's UUID in single player; level.dat's singleplayer_uuid stores it):

  • Villager.setLastHurtByMob reports ReputationEventType.VILLAGER_HURT for the attacking player.
  • Villager.tellWitnessesThatIWasMurdered reports VILLAGER_KILLED to witnesses for the killer.
  • Villager.startTrading → updateSpecialPrices → getPlayerReputation(player) reads the same player's UUID.

So a hit raises that player's prices (minor_negative 25 → reputation −25 → cost + floor(25 × priceMultiplier)).

Where in Horizon

At origin/main 142388e1c:

  • crates/horizon-client/src/game/villagers.rs:370 (villager_reputation_tick, the hurt gossip) and :407 (villager_murdered) use self.level.player_uuid for any Who::Player hit or kill. That includes the server-thread owner and LAN guests.
  • crates/horizon-client/src/game/lan_trading.rs:47-53 takes the reputation for the trade screen from host.hub.guests[gi].uuid, the connection UUID.
  • crates/horizon-client/src/game/commands/data.rs:41,52: /data get entity @s writes self.level.player_uuid as the player's UUID, even when it runs for a guest (for_player → Target::Player). enter_guest (game/lan_actions.rs) swaps in lan_acting_uuid but not level.player_uuid.

Seen in game (current main, --world T, server thread, player Player11290)

  1. /data get entity @s UUID gave [I; -1608632253, -450807400, -1786055591, -2146546415] = a01e3843-e521-3998-958a-f459800e4d11. That is level.dat's singleplayer_uuid and the players/data file name. The player's connection UUID is offline_uuid("Player11290") = c19f7df6-e5ab-397f-88c2-700c4b25f746.
  2. /summon minecraft:villager ~ ~ ~2 {NoAI:1b,VillagerData:{profession:"minecraft:farmer",level:1,type:"minecraft:plains"}}, punched it once, then /data get entity @e[type=villager,limit=1] Gossips gave [{Target: [I; -1608632253, -450807400, -1786055591, -2146546415], Type: "minor_negative", Value: 25}]. The gossip is under a01e3843…, not the connection UUID that lan_trading.rs:47 looks up.

I did not get to compare the trade price before and after the hit in game (the control socket stopped listing entities). That step is from code: lan_trading.rs:53 finds no gossip for c19f7df6…, so the reputation stays 0. #3404 saw the same effect for the cure gossip (reputation 0, no discount).

Notes

  • #3404 fixed this class of bug only for zombie-villager curing (acting_player_uuid() plus a lookup of the starter among players present). The hurt and murder gossip need the same treatment, recording the gossip for the acting player (acting_player_uuid()).
  • It's unclear which of the two UUIDs is meant to be "the" player's in-world UUID. records_uuid (game/lan.rs:1243) deliberately maps the owner's files to level.player_uuid. The bug is that the two are mixed. Other self.level.player_uuid uses may have the same mix-up on the server thread; I didn't check them one by one. They include tamed or leashed owners (game/mounts.rs:469, game/leads.rs:95, game/nautili.rs:82), projectile Owner in /data (commands/data.rs:127), game/raids.rs:1040, and game/allays.rs:99.
  • villagers.rs:438/457 (villager_traded, villager_reputation) are the in-frame path. On the server thread, guests go through lan_trading.rs with the right UUID.
  • Same root, seen independently: open PR #2720 notes that MobEvent::Tamed makes the server's own player_uuid the owner of a tamed horse, not the guest who tamed it.
Originally created by @degepie on GitHub (Oct 28, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/3431 > 🤖 Filed by degepie's AI agent (Claude Code), not by degepie personally. ## What happens On the default single-player path, the world runs on the integrated server thread and the window's player joins it as a guest. That player ends up with two UUIDs: - **Connection/profile UUID:** `offline_uuid(name)` (`crates/horizon-client/src/game/integrated.rs:231`). Trading and #3404's cure credit use this one. - **The server `Game`'s `self.level.player_uuid`:** the world's `singleplayer_uuid`, also the name of the `players/data/*.dat` file. Several other code paths use this one. Villager gossip is split between the two: - Hitting a villager (`minor_negative`) and killing one in front of witnesses (`major_negative`) are recorded under `self.level.player_uuid`. - The trade screen reads the player's reputation under the connection UUID. So on the server thread, hitting or murdering villagers never raises that player's prices. The gossip is filed under a UUID that no connected player has. ## What vanilla does There is one UUID per player (`Entity.getUUID`, the profile's UUID in single player; level.dat's `singleplayer_uuid` stores it): - `Villager.setLastHurtByMob` reports `ReputationEventType.VILLAGER_HURT` for the attacking player. - `Villager.tellWitnessesThatIWasMurdered` reports `VILLAGER_KILLED` to witnesses for the killer. - `Villager.startTrading` → `updateSpecialPrices` → `getPlayerReputation(player)` reads the same player's UUID. So a hit raises that player's prices (`minor_negative` 25 → reputation −25 → cost + `floor(25 × priceMultiplier)`). ## Where in Horizon At `origin/main` 142388e1c: - `crates/horizon-client/src/game/villagers.rs:370` (`villager_reputation_tick`, the hurt gossip) and `:407` (`villager_murdered`) use `self.level.player_uuid` for any `Who::Player` hit or kill. That includes the server-thread owner and LAN guests. - `crates/horizon-client/src/game/lan_trading.rs:47-53` takes the reputation for the trade screen from `host.hub.guests[gi].uuid`, the connection UUID. - `crates/horizon-client/src/game/commands/data.rs:41,52`: `/data get entity @s` writes `self.level.player_uuid` as the player's `UUID`, even when it runs for a guest (`for_player` → `Target::Player`). `enter_guest` (`game/lan_actions.rs`) swaps in `lan_acting_uuid` but not `level.player_uuid`. ## Seen in game (current main, `--world T`, server thread, player `Player11290`) 1. `/data get entity @s UUID` gave `[I; -1608632253, -450807400, -1786055591, -2146546415]` = `a01e3843-e521-3998-958a-f459800e4d11`. That is level.dat's `singleplayer_uuid` and the `players/data` file name. The player's connection UUID is `offline_uuid("Player11290")` = `c19f7df6-e5ab-397f-88c2-700c4b25f746`. 2. `/summon minecraft:villager ~ ~ ~2 {NoAI:1b,VillagerData:{profession:"minecraft:farmer",level:1,type:"minecraft:plains"}}`, punched it once, then `/data get entity @e[type=villager,limit=1] Gossips` gave `[{Target: [I; -1608632253, -450807400, -1786055591, -2146546415], Type: "minor_negative", Value: 25}]`. The gossip is under `a01e3843…`, not the connection UUID that `lan_trading.rs:47` looks up. I did not get to compare the trade price before and after the hit in game (the control socket stopped listing entities). That step is from code: `lan_trading.rs:53` finds no gossip for `c19f7df6…`, so the reputation stays 0. #3404 saw the same effect for the cure gossip (reputation 0, no discount). ## Notes - #3404 fixed this class of bug only for zombie-villager curing (`acting_player_uuid()` plus a lookup of the starter among players present). The hurt and murder gossip need the same treatment, recording the gossip for the acting player (`acting_player_uuid()`). - It's unclear which of the two UUIDs is meant to be "the" player's in-world UUID. `records_uuid` (`game/lan.rs:1243`) deliberately maps the owner's files to `level.player_uuid`. The bug is that the two are mixed. Other `self.level.player_uuid` uses may have the same mix-up on the server thread; I didn't check them one by one. They include tamed or leashed owners (`game/mounts.rs:469`, `game/leads.rs:95`, `game/nautili.rs:82`), projectile `Owner` in `/data` (`commands/data.rs:127`), `game/raids.rs:1040`, and `game/allays.rs:99`. - `villagers.rs:438/457` (`villager_traded`, `villager_reputation`) are the in-frame path. On the server thread, guests go through `lan_trading.rs` with the right UUID. - Same root, seen independently: open PR #2720 notes that `MobEvent::Tamed` makes the server's own `player_uuid` the owner of a tamed horse, not the guest who tamed it.
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#973
No description provided.