[PR #5822] [MERGED] Foxes and dolphins pick up items as vanilla #6512

Closed
opened 2026-11-03 06:22:01 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5822
Author: @xFedeT
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/fox-item-pickup


📝 Commits (3)

  • 0a1dd1f Foxes and dolphins pick up items as vanilla
  • c03ef70 Merge remote-tracking branch 'origin/main' into fix/fox-item-pickup
  • 337c3c2 Merge main into #5822

📊 Changes

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

View changed files

📝 crates/horizon-client/src/game.rs (+1 -0)
📝 crates/horizon-client/src/game/creatures.rs (+16 -0)
➕ crates/horizon-client/src/game/foxes.rs (+166 -0)
📝 crates/horizon-client/src/mobs.rs (+8 -0)
📝 crates/horizon-client/src/mobs/aquatic.rs (+2 -0)
📝 crates/horizon-client/src/mobs/dolphin.rs (+158 -1)
📝 crates/horizon-client/src/mobs/fox.rs (+99 -2)

📄 Description

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

Part of #3512. Closes the last rows of that list that had no code: Fox.pickUpItem, Fox.canHoldItem, Fox.FoxSearchForItemsGoal, Dolphin.MoveToItemGoal (canUse, start, stop), Dolphin.PlayWithItemsGoal, Dolphin.pickUpItem, Dolphin.ItemGoal.drop, Dolphin.ItemGoal.dropItem and the item goals of Dolphin.registerGoals.

What vanilla does

  • Fox. FoxSearchForItemsGoal (priority 11, after the stroll) runs while the mouth is empty, with no target and not hurt: one in reducedTickDelay(10) ticks it looks for an item within 8 blocks (ALLOWED_ITEMS: no pickup delay, alive) and walks to the first at 1.2. pickUpItem (from Mob.aiStep's looting) takes it when canHoldItem: the mouth is empty, or it has eaten (ticksSinceEaten > 0) and the item is consumable food while what it holds is not. It drops count - 1 at its feet, spits what it held out in front (entity.fox.spit, pickup delay 40, thrown by the fox), holds one item with a guaranteed drop, and restarts ticksSinceEaten.
  • Dolphin. MoveToItemGoal (priority 7) swims to the first item floating in water within 8 blocks and plays entity.dolphin.play; when it stops it drops what it holds and rests for up to 100 ticks. PlayWithItemsGoal (8) throws what it holds. pickUpItem takes a whole stack into an empty mouth. ItemGoal.drop throws from the eye height less 0.3, forward at 0.3 with a random sideways 0.02 at most, and a pickup delay of 40.

What this changes

  • mobs/fox.rs: SearchForItems goal, can_hold_item, took_item, set_item_at.
  • mobs/dolphin.rs: MoveToItem, PlayWithItems, drop_item, set_item_at; registered in mobs/aquatic.rs.
  • game/foxes.rs (new): the game side, as pandas.rs and allays.rs do it: Fox.pickUpItem and Dolphin.pickUpItem in the looting step, and the item a goal walks to (the mob lib cannot see item entities).
  • MobEvent::ThrowItem: a thrown item with its motion, pickup delay and thrower (creatures.rs).
  • Port-map rows for these methods are not touched here: they were missing and a follow-up flips them.

Verification

  • tools/parity.py mob_ai: passes (the fox goal list gains one nextInt(reducedTickDelay(10)) draw per tick that the oracle already made).
  • pr_ready --quick: fmt, clippy, 1661 horizon-client tests, Python tests pass.
  • Unit tests: Fox.canHoldItem over its cases (empty mouth, food swap needs ticksSinceEaten > 0, food does not replace food), and a dolphin throwing a stack forward at 0.3 with delay 40 and an empty mouth after.
  • Live, offscreen game (horizon-ctl, scratch homes): a fox summoned with CanPickUpLoot:1b walked to a dropped stack of 2 sticks and picked it up (1 in the mouth, 1 left on the ground); a dolphin in a glass tank swam to a cod, took it and threw it.

Screenshots: fox dolphin

Not checked against the oracle: the order of the item list (getEntitiesOfClass order) is the order of the dropped items here; with several items near it a fox could pick another first. A /summon fox with no NBT has CanPickUpLoot false, as in vanilla (Mob.readAdditionalSaveData defaults it to false), so a summoned fox does not pick up unless the tag is set.

🤖 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/5822 **Author:** [@xFedeT](https://github.com/xFedeT) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/fox-item-pickup` --- ### 📝 Commits (3) - [`0a1dd1f`](https://github.com/horizon-rust/horizon/commit/0a1dd1fe1fb24925529af632455d046d86b68b14) Foxes and dolphins pick up items as vanilla - [`c03ef70`](https://github.com/horizon-rust/horizon/commit/c03ef707ed7a14ffe66ed7aaf3c250f8f7cc202e) Merge remote-tracking branch 'origin/main' into fix/fox-item-pickup - [`337c3c2`](https://github.com/horizon-rust/horizon/commit/337c3c2bb4e160ba9fe2baa40c791e645c436d5d) Merge main into #5822 ### 📊 Changes **7 files changed** (+450 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+1 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+16 -0) ➕ `crates/horizon-client/src/game/foxes.rs` (+166 -0) 📝 `crates/horizon-client/src/mobs.rs` (+8 -0) 📝 `crates/horizon-client/src/mobs/aquatic.rs` (+2 -0) 📝 `crates/horizon-client/src/mobs/dolphin.rs` (+158 -1) 📝 `crates/horizon-client/src/mobs/fox.rs` (+99 -2) </details> ### 📄 Description > 🤖 Opened by xFedeT's AI agent (Claude Code, Claude Sonnet 5.5), not by xFedeT personally. Part of #3512. Closes the last rows of that list that had no code: `Fox.pickUpItem`, `Fox.canHoldItem`, `Fox.FoxSearchForItemsGoal`, `Dolphin.MoveToItemGoal` (`canUse`, `start`, `stop`), `Dolphin.PlayWithItemsGoal`, `Dolphin.pickUpItem`, `Dolphin.ItemGoal.drop`, `Dolphin.ItemGoal.dropItem` and the item goals of `Dolphin.registerGoals`. ## What vanilla does - **Fox.** `FoxSearchForItemsGoal` (priority 11, after the stroll) runs while the mouth is empty, with no target and not hurt: one in `reducedTickDelay(10)` ticks it looks for an item within 8 blocks (`ALLOWED_ITEMS`: no pickup delay, alive) and walks to the first at 1.2. `pickUpItem` (from `Mob.aiStep`'s looting) takes it when `canHoldItem`: the mouth is empty, or it has eaten (`ticksSinceEaten > 0`) and the item is consumable food while what it holds is not. It drops `count - 1` at its feet, spits what it held out in front (`entity.fox.spit`, pickup delay 40, thrown by the fox), holds one item with a guaranteed drop, and restarts `ticksSinceEaten`. - **Dolphin.** `MoveToItemGoal` (priority 7) swims to the first item floating in water within 8 blocks and plays `entity.dolphin.play`; when it stops it drops what it holds and rests for up to 100 ticks. `PlayWithItemsGoal` (8) throws what it holds. `pickUpItem` takes a whole stack into an empty mouth. `ItemGoal.drop` throws from the eye height less 0.3, forward at 0.3 with a random sideways 0.02 at most, and a pickup delay of 40. ## What this changes - `mobs/fox.rs`: `SearchForItems` goal, `can_hold_item`, `took_item`, `set_item_at`. - `mobs/dolphin.rs`: `MoveToItem`, `PlayWithItems`, `drop_item`, `set_item_at`; registered in `mobs/aquatic.rs`. - `game/foxes.rs` (new): the game side, as `pandas.rs` and `allays.rs` do it: `Fox.pickUpItem` and `Dolphin.pickUpItem` in the looting step, and the item a goal walks to (the mob lib cannot see item entities). - `MobEvent::ThrowItem`: a thrown item with its motion, pickup delay and thrower (`creatures.rs`). - Port-map rows for these methods are not touched here: they were `missing` and a follow-up flips them. ## Verification - `tools/parity.py mob_ai`: passes (the fox goal list gains one `nextInt(reducedTickDelay(10))` draw per tick that the oracle already made). - `pr_ready --quick`: fmt, clippy, 1661 `horizon-client` tests, Python tests pass. - Unit tests: `Fox.canHoldItem` over its cases (empty mouth, food swap needs `ticksSinceEaten > 0`, food does not replace food), and a dolphin throwing a stack forward at 0.3 with delay 40 and an empty mouth after. - Live, offscreen game (`horizon-ctl`, scratch homes): a fox summoned with `CanPickUpLoot:1b` walked to a dropped stack of 2 sticks and picked it up (1 in the mouth, 1 left on the ground); a dolphin in a glass tank swam to a cod, took it and threw it. Screenshots: ![fox](https://github.com/xFedeT/horizon/blob/pr-screenshots/3512/fox-picks-up-item.png?raw=true) ![dolphin](https://github.com/xFedeT/horizon/blob/pr-screenshots/3512/dolphin-items.png?raw=true) Not checked against the oracle: the order of the item list (`getEntitiesOfClass` order) is the order of the dropped items here; with several items near it a fox could pick another first. A `/summon fox` with no NBT has `CanPickUpLoot` false, as in vanilla (`Mob.readAdditionalSaveData` defaults it to false), so a summoned fox does not pick up unless the tag is set. 🤖 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 06:22:01 +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#6512
No description provided.