[PR #307] [MERGED] Bees live in hives and nests: they go home, come out in the morning and make honey (#208) #2476

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

📋 Pull Request Information

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

Base: main ← Head: feat/bee-hives


📝 Commits (2)

  • 111b237 Bees live in hives and nests: they go home, come out in the morning and make honey (#208)
  • 5876014 Droppers and hoppers don't take a beehive for a container

📊 Changes

14 files changed (+1109 additions, -47 deletions)

View changed files

📝 crates/horizon-client/examples/mob_ai_probe.rs (+187 -2)
➕ crates/horizon-client/src/beehive.rs (+438 -0)
📝 crates/horizon-client/src/containers.rs (+11 -3)
📝 crates/horizon-client/src/game.rs (+16 -2)
➕ crates/horizon-client/src/game/beehives.rs (+238 -0)
📝 crates/horizon-client/src/game/creatures.rs (+1 -0)
📝 crates/horizon-client/src/game/dispenser.rs (+13 -1)
📝 crates/horizon-client/src/game/machines.rs (+4 -0)
📝 crates/horizon-client/src/lib.rs (+1 -0)
📝 crates/horizon-client/src/mobs.rs (+6 -0)
📝 crates/horizon-client/src/mobs/bee.rs (+130 -21)
📝 crates/horizon-client/src/save.rs (+2 -0)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMobAiOracle.java (+50 -16)
📝 tools/test_mob_ai_parity.py (+12 -2)

📄 Description

Follow-up of #208 (bees, #291).

What

Bees now live in hives and nests.

  • Hives and nests keep their bees (crate::beehive, BeehiveBlockEntity): up to three bees stored as entity tags (without IGNORED_BEE_TAGS). Each stays 600 ticks, or 2400 with nectar. A bee whose time is up comes out through the hive's front, but not at night, not in the rain and not through a blocked front. A bee bringing nectar raises the honey level by 1 (2 one time in 100, capped at 5). The hive hums now and then, keeps the flower one of its bees knew and hands it on, and plays the enter/exit/work sounds. Save format is vanilla's: bees (entity_data, ticks_in_hive, min_ticks_in_hive) and flower_pos. Worldgen nests (BeehiveDecorator already stored their bees) now release them in the morning.
  • Bees go home (bee.rs): BeeLocateHiveGoal finds the nearest hive with room within 20 blocks, skipping blacklisted ones (the blacklist now lives on the bee). BeeGoToHiveGoal and BeeEnterHiveGoal take it in at night, in the rain, with nectar, or when the bee is tired of looking for nectar, but not with fire next to the hive; a full hive is forgotten. BeeWanderGoal heads back towards a hive farther than 24 blocks. The validate-hive and grow-crop goals now see real hives. A bee leaving a hive is loaded from its tag with no gravity, its hive set, its age and love time moved on by its time inside, and its nectar dropped off.
  • Game: hives tick with the other block entities. Breaking one without silk touch lets every bee out angry at the player within 4 blocks, unless a lit campfire's smoke rises under the hive (CampfireBlock.isSmokeyPos), then angerNearbyBees. Fire next to a hive empties it. Dispensers harvesting honey (bottles, shears) let the bees out (BEE_RELEASED). Droppers and hoppers don't take a hive for a container (it is no Container in vanilla): a dropper facing one throws the item out.

Why one PR (~1100 lines)

The hive, the goals that bring bees to it and the scenarios that prove both against vanilla only make sense together. About 600 lines are game code, about 250 are probe/oracle harness and about 70 are tests.

How tested

New mob_ai scenarios (oracle gains a nectar flag and a per-tick hive line: honey, each bee's ticks/min ticks, flower; the probe gains daycycle and hive ticking). A bee leaving a hive is seeded like other newcomers and takes the probe's entity id (100000 + index), since goals run in full on ticks where tickCount + id is even.

bee_hive_night: all 301 ticks match      (finds the hive, flies in at tick 26, stays)
bee_hive_rain: all 301 ticks match
bee_hive_morning: all 1001 ticks match   (in at night, out at 23527 once its 600 ticks are up)
bee_hive_honey: all 2601 ticks match     (nectar bee by day: in, out after 2400 ticks, honey 0 -> 1)

Self-check

  • cargo fmt --all -- --check: clean
  • cargo clippy --workspace --all-targets -- -D warnings: clean
  • cargo test -p horizon-client: 688 passed, 0 failed
  • python3 tools/parity.py --changed origin/main: 79/79 harnesses pass, among them mob_ai (124/124 scenarios, 48754/48754 mob-ticks: the 120 on main plus the 4 new ones), dispenser, block_entity_render and block_entity_anim. The first run caught a dropper facing a hive doing nothing; fixed in the second commit.
  • python3 tools/parity.py save_roundtrip (macOS, its scene has a beehive holding a bee): the hive's bees and flower_pos round-trip (only ticks_in_hive moves on, an ignored timer). The one remaining difference is the copper golem PersistenceRequired already failing on main (#289).

In game (Mac mini, offscreen render)

A beehive and two nectar bees in a fresh creative world. At dusk the bees fly to the hive and go in; at dawn the ones without nectar come back out. Two nectar bees went into a hive at honey 3, came out 2400 ticks later and left it at honey 5 (full-honey front). The world was saved and reopened in between and the honey level survived the reload.

Needs Ludovic

Nothing.

Not in this PR (follow-ups)

  • Taking honey with a bottle or shears by hand (BeehiveBlock.useItemOn). Only dispensers do it today.
  • Silk-touch drops keeping the bees in the item (minecraft:bees component), and explosions releasing them.

🤖 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/307 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/bee-hives` --- ### 📝 Commits (2) - [`111b237`](https://github.com/horizon-rust/horizon/commit/111b237b6d78596dcdb3eb2dd28019aff317ed4b) Bees live in hives and nests: they go home, come out in the morning and make honey (#208) - [`5876014`](https://github.com/horizon-rust/horizon/commit/5876014b5705bd18d0a07c95a7523bce2d2927ef) Droppers and hoppers don't take a beehive for a container ### 📊 Changes **14 files changed** (+1109 additions, -47 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/mob_ai_probe.rs` (+187 -2) ➕ `crates/horizon-client/src/beehive.rs` (+438 -0) 📝 `crates/horizon-client/src/containers.rs` (+11 -3) 📝 `crates/horizon-client/src/game.rs` (+16 -2) ➕ `crates/horizon-client/src/game/beehives.rs` (+238 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+1 -0) 📝 `crates/horizon-client/src/game/dispenser.rs` (+13 -1) 📝 `crates/horizon-client/src/game/machines.rs` (+4 -0) 📝 `crates/horizon-client/src/lib.rs` (+1 -0) 📝 `crates/horizon-client/src/mobs.rs` (+6 -0) 📝 `crates/horizon-client/src/mobs/bee.rs` (+130 -21) 📝 `crates/horizon-client/src/save.rs` (+2 -0) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMobAiOracle.java` (+50 -16) 📝 `tools/test_mob_ai_parity.py` (+12 -2) </details> ### 📄 Description Follow-up of #208 (bees, #291). ## What Bees now live in hives and nests. - **Hives and nests keep their bees** (`crate::beehive`, `BeehiveBlockEntity`): up to three bees stored as entity tags (without `IGNORED_BEE_TAGS`). Each stays 600 ticks, or 2400 with nectar. A bee whose time is up comes out through the hive's front, but not at night, not in the rain and not through a blocked front. A bee bringing nectar raises the honey level by 1 (2 one time in 100, capped at 5). The hive hums now and then, keeps the flower one of its bees knew and hands it on, and plays the enter/exit/work sounds. Save format is vanilla's: `bees` (`entity_data`, `ticks_in_hive`, `min_ticks_in_hive`) and `flower_pos`. Worldgen nests (BeehiveDecorator already stored their bees) now release them in the morning. - **Bees go home** (`bee.rs`): `BeeLocateHiveGoal` finds the nearest hive with room within 20 blocks, skipping blacklisted ones (the blacklist now lives on the bee). `BeeGoToHiveGoal` and `BeeEnterHiveGoal` take it in at night, in the rain, with nectar, or when the bee is tired of looking for nectar, but not with fire next to the hive; a full hive is forgotten. `BeeWanderGoal` heads back towards a hive farther than 24 blocks. The validate-hive and grow-crop goals now see real hives. A bee leaving a hive is loaded from its tag with no gravity, its hive set, its age and love time moved on by its time inside, and its nectar dropped off. - **Game:** hives tick with the other block entities. Breaking one without silk touch lets every bee out angry at the player within 4 blocks, unless a lit campfire's smoke rises under the hive (`CampfireBlock.isSmokeyPos`), then `angerNearbyBees`. Fire next to a hive empties it. Dispensers harvesting honey (bottles, shears) let the bees out (`BEE_RELEASED`). Droppers and hoppers don't take a hive for a container (it is no `Container` in vanilla): a dropper facing one throws the item out. ## Why one PR (~1100 lines) The hive, the goals that bring bees to it and the scenarios that prove both against vanilla only make sense together. About 600 lines are game code, about 250 are probe/oracle harness and about 70 are tests. ## How tested New mob_ai scenarios (oracle gains a `nectar` flag and a per-tick `hive` line: honey, each bee's ticks/min ticks, flower; the probe gains `daycycle` and hive ticking). A bee leaving a hive is seeded like other newcomers and takes the probe's entity id (100000 + index), since goals run in full on ticks where tickCount + id is even. ``` bee_hive_night: all 301 ticks match (finds the hive, flies in at tick 26, stays) bee_hive_rain: all 301 ticks match bee_hive_morning: all 1001 ticks match (in at night, out at 23527 once its 600 ticks are up) bee_hive_honey: all 2601 ticks match (nectar bee by day: in, out after 2400 ticks, honey 0 -> 1) ``` ### Self-check - `cargo fmt --all -- --check`: clean - `cargo clippy --workspace --all-targets -- -D warnings`: clean - `cargo test -p horizon-client`: 688 passed, 0 failed - `python3 tools/parity.py --changed origin/main`: 79/79 harnesses pass, among them mob_ai (124/124 scenarios, 48754/48754 mob-ticks: the 120 on main plus the 4 new ones), dispenser, block_entity_render and block_entity_anim. The first run caught a dropper facing a hive doing nothing; fixed in the second commit. - `python3 tools/parity.py save_roundtrip` (macOS, its scene has a beehive holding a bee): the hive's `bees` and `flower_pos` round-trip (only `ticks_in_hive` moves on, an ignored timer). The one remaining difference is the copper golem `PersistenceRequired` already failing on main (#289). ### In game (Mac mini, offscreen render) A beehive and two nectar bees in a fresh creative world. At dusk the bees fly to the hive and go in; at dawn the ones without nectar come back out. Two nectar bees went into a hive at honey 3, came out 2400 ticks later and left it at honey 5 (full-honey front). The world was saved and reopened in between and the honey level survived the reload. ## Needs Ludovic Nothing. ## Not in this PR (follow-ups) - Taking honey with a bottle or shears by hand (`BeehiveBlock.useItemOn`). Only dispensers do it today. - Silk-touch drops keeping the bees in the item (`minecraft:bees` component), and explosions releasing them. 🤖 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-02 15:56:31 +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#2476
No description provided.