[PR #4603] [MERGED] Piglins open the doors on their path (InteractWithDoor) #5723

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4603
Author: @xFedeT
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/piglin-doors


📝 Commits (1)

  • 6b3aacf Piglins open the doors on their path (InteractWithDoor)

📊 Changes

2 files changed (+97 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/mobs/doors.rs (+93 -0)
📝 crates/horizon-client/src/mobs/piglin.rs (+4 -0)

📄 Description

🤖 Opened by xFedeT's AI agent (Claude Code, Sonnet 5.5), not by xFedeT personally.

Refs #3521 (row InteractWithDoor.create, the piglin part)

What

A piglin could not path through a door: its navigation did not open doors and it had no InteractWithDoor behaviour. In vanilla AbstractPiglin sets getNavigation().setCanOpenDoors(true) and PiglinAi.initCoreActivity runs InteractWithDoor.create().

  • register_piglin sets can_open_doors (so the path goes through a closed wooden door).
  • New goal InteractWithDoor in mobs/doors.rs, registered on the piglin without flags (a core behaviour runs every tick). While the mob follows a path it opens the door it is leaving and the one it enters, remembers the doors it opened (the one it leaves even when it was open already), and closes the remembered doors other than the two of the step it takes when they are open and within 3 blocks. It re-checks a node again only after the 20 tick cooldown, as lastCheckedNode / remainingCooldown do.

I read InteractWithDoor.java first and ported it step by step; the copper golem's version in #4518 is the same behaviour on the animal brain, this one is a goal for the piglin's goal stand-in.

Proof

Real game (horizon-ctl, scratch dirs): a stone wall across a flat platform with a closed oak door, a piglin with a golden sword on one side, the player (survival, resistance) on the other. The piglin is hurt by the player so it chases. Door state sampled every 5 ticks from the first frame (open= of the door's lower half): false, then true from the second sample on, and the piglin reaches the player on the other side. Before, a piglin pathed round the wall or stayed on its side (the goals list shows InteractWithDoor running while it follows the path).

Door closed The piglin comes through

pr_ready --quick: fmt, clippy, 1085 horizon-client tests and 481 Python tests pass.

Notes

  • No tick-for-tick check: the mob_ai probe has no piglin brain.
  • Another piglin coming through the door is not looked for (areOtherMobsComingThroughDoor), same as the golem's version.
  • The port map row for InteractWithDoor.create is also edited by #4518 (the golem), so this PR leaves it for whichever lands second.
  • Door state isn't saved by the goal (the remembered doors reset on reload), as the brain memory is not saved either.

🤖 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/4603 **Author:** [@xFedeT](https://github.com/xFedeT) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/piglin-doors` --- ### 📝 Commits (1) - [`6b3aacf`](https://github.com/horizon-rust/horizon/commit/6b3aacf6192f8d30139ff3b3cc3a8cd0b9bfbcb5) Piglins open the doors on their path (InteractWithDoor) ### 📊 Changes **2 files changed** (+97 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/doors.rs` (+93 -0) 📝 `crates/horizon-client/src/mobs/piglin.rs` (+4 -0) </details> ### 📄 Description > 🤖 Opened by xFedeT's AI agent (Claude Code, Sonnet 5.5), not by xFedeT personally. Refs #3521 (row `InteractWithDoor.create`, the piglin part) ## What A piglin could not path through a door: its navigation did not open doors and it had no `InteractWithDoor` behaviour. In vanilla `AbstractPiglin` sets `getNavigation().setCanOpenDoors(true)` and `PiglinAi.initCoreActivity` runs `InteractWithDoor.create()`. - `register_piglin` sets `can_open_doors` (so the path goes through a closed wooden door). - New goal `InteractWithDoor` in `mobs/doors.rs`, registered on the piglin without flags (a core behaviour runs every tick). While the mob follows a path it opens the door it is leaving and the one it enters, remembers the doors it opened (the one it leaves even when it was open already), and closes the remembered doors other than the two of the step it takes when they are open and within 3 blocks. It re-checks a node again only after the 20 tick cooldown, as `lastCheckedNode` / `remainingCooldown` do. I read `InteractWithDoor.java` first and ported it step by step; the copper golem's version in #4518 is the same behaviour on the animal brain, this one is a goal for the piglin's goal stand-in. ## Proof Real game (`horizon-ctl`, scratch dirs): a stone wall across a flat platform with a closed oak door, a piglin with a golden sword on one side, the player (survival, resistance) on the other. The piglin is hurt by the player so it chases. Door state sampled every 5 ticks from the first frame (`open=` of the door's lower half): `false`, then `true` from the second sample on, and the piglin reaches the player on the other side. Before, a piglin pathed round the wall or stayed on its side (the `goals` list shows `InteractWithDoor` running while it follows the path). ![](https://raw.githubusercontent.com/xFedeT/horizon/pr-screenshots/piglin-doors/piglin-door.gif) | Door closed | The piglin comes through | |---|---| | ![](https://raw.githubusercontent.com/xFedeT/horizon/pr-screenshots/piglin-doors/closed.png) | ![](https://raw.githubusercontent.com/xFedeT/horizon/pr-screenshots/piglin-doors/opening.png) | `pr_ready --quick`: fmt, clippy, 1085 `horizon-client` tests and 481 Python tests pass. ## Notes - No tick-for-tick check: the `mob_ai` probe has no piglin brain. - Another piglin coming through the door is not looked for (`areOtherMobsComingThroughDoor`), same as the golem's version. - The port map row for `InteractWithDoor.create` is also edited by #4518 (the golem), so this PR leaves it for whichever lands second. - Door state isn't saved by the goal (the remembered doors reset on reload), as the brain memory is not saved either. 🤖 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 05:14:33 +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#5723
No description provided.