[PR #3123] [MERGED] An iron golem you built no longer attacks you #4814

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

📋 Pull Request Information

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

Base: main ← Head: fix/player-built-golem-forgives


📝 Commits (2)

  • e3fda9c Keep golems built by a player from attacking players
  • 1970ab1 Merge main into fix/player-built-golem-forgives

📊 Changes

5 files changed (+35 additions, -5 deletions)

View changed files

📝 crates/horizon-client/src/entity_nbt.rs (+11 -0)
📝 crates/horizon-client/src/game/golems.rs (+7 -1)
📝 crates/horizon-client/src/mobs.rs (+2 -0)
📝 crates/horizon-client/src/mobs/goals.rs (+12 -2)
📝 crates/horizon-client/src/mobs/golem.rs (+3 -2)

📄 Description

What and why

  • A player built an iron golem from iron blocks and a pumpkin, hit it, and it hit back. In vanilla a golem built by a player never attacks players: it only defends them.
  • Horizon never marked a built golem as player created, and no target goal knew the rule.
  • A golem built by a player or a dispenser is now marked PlayerCreated (saved and loaded as PlayerCreated in NBT, so /summon with it set works too). A marked golem refuses a player as a target in all its goals: hurt by, defend the village, angry at, and while keeping a target. It still goes after monsters, and golems from villages (not marked) still turn on a player they are angry at.
  • Works on the server-thread path: the build goes through check_golem_spawn, shared by players, guests and dispensers.

No open issue matches this report yet.

Vanilla reference

  • CarvedPumpkinBlock.trySpawnGolem (setPlayerCreated(true))
  • IronGolem.canAttack, addAdditionalSaveData, readAdditionalSaveData, isPlayerCreated
  • Mob.asValidTarget, TargetGoal.canContinueToUse and TargetingConditions.test (all call canAttack)

Self-check

fmt passes. Built and tested by this pull request's checks. Not run in game.

Fixes #3138


🔄 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/3123 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/player-built-golem-forgives` --- ### 📝 Commits (2) - [`e3fda9c`](https://github.com/horizon-rust/horizon/commit/e3fda9ce6754e4de6b762a3c89ff2656cabbca43) Keep golems built by a player from attacking players - [`1970ab1`](https://github.com/horizon-rust/horizon/commit/1970ab1a7b7b342de358432455a0147e69993564) Merge main into fix/player-built-golem-forgives ### 📊 Changes **5 files changed** (+35 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entity_nbt.rs` (+11 -0) 📝 `crates/horizon-client/src/game/golems.rs` (+7 -1) 📝 `crates/horizon-client/src/mobs.rs` (+2 -0) 📝 `crates/horizon-client/src/mobs/goals.rs` (+12 -2) 📝 `crates/horizon-client/src/mobs/golem.rs` (+3 -2) </details> ### 📄 Description ## What and why - A player built an iron golem from iron blocks and a pumpkin, hit it, and it hit back. In vanilla a golem built by a player never attacks players: it only defends them. - Horizon never marked a built golem as player created, and no target goal knew the rule. - A golem built by a player or a dispenser is now marked `PlayerCreated` (saved and loaded as `PlayerCreated` in NBT, so `/summon` with it set works too). A marked golem refuses a player as a target in all its goals: hurt by, defend the village, angry at, and while keeping a target. It still goes after monsters, and golems from villages (not marked) still turn on a player they are angry at. - Works on the server-thread path: the build goes through `check_golem_spawn`, shared by players, guests and dispensers. No open issue matches this report yet. ## Vanilla reference - `CarvedPumpkinBlock.trySpawnGolem` (`setPlayerCreated(true)`) - `IronGolem.canAttack`, `addAdditionalSaveData`, `readAdditionalSaveData`, `isPlayerCreated` - `Mob.asValidTarget`, `TargetGoal.canContinueToUse` and `TargetingConditions.test` (all call `canAttack`) ## Self-check fmt passes. Built and tested by this pull request's checks. Not run in game. Fixes #3138 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:08:08 +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#4814
No description provided.