[PR #2137] [MERGED] Chickens lay eggs again, and breaking snow and chorus flowers drops items #4039

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

📋 Pull Request Information

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

Base: main ← Head: fix/chicken-eggs


📝 Commits (1)

  • 6c7a90c Let chickens lay eggs and players get snow and chorus flowers from loot tables

📊 Changes

9 files changed (+103 additions, -17 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+5 -4)
📝 crates/horizon-client/src/game/creatures.rs (+42 -9)
📝 crates/horizon-client/src/game/explosion.rs (+1 -0)
📝 crates/horizon-client/src/items.rs (+42 -3)
📝 crates/horizon-client/src/mobs.rs (+3 -1)
📝 crates/horizon-client/src/mobs/drops.rs (+3 -0)
📝 crates/horizon-client/src/mobs/farm.rs (+1 -0)
📝 crates/horizon-client/src/mobs/sniffer.rs (+1 -0)
📝 crates/horizon-world/src/loot.rs (+5 -0)

📄 Description

What and why

Chickens never laid eggs, and breaking snow layers or a chorus flower gave nothing. Both come from the same gap: loot conditions of type minecraft:entity_properties always failed, because the loot context had no entity.

Reproduced in game: 4 chickens, /tick sprint 13000, zero eggs. The egg sound played, but no item dropped.

  • Chickens and gift loot. chicken_lay is an alternatives of three egg items, each gated by entity_properties on this with the chicken's variant. MobEvent::GiftLoot now carries the mob id. The game rolls the table with horizon_world::loot (the engine the death loot already uses), from the table's random sequence, with the mob as this. LootEntity gets a chicken_variant, filled from the mob's variant, and the minecraft:components predicate understands minecraft:chicken/variant. Temperate chickens lay eggs, warm ones brown eggs, cold ones blue eggs. Sniffer digging uses the same path; its table has no conditions, so it behaves as before (it now also draws from its own random sequence). If the loot data is missing the old roll is used as a fallback.
  • Snow and chorus flowers. snow.json and chorus_flower.json require entity_properties for this with an empty predicate. When a player breaks a block (the local player and guests share break_block_as_player), the player is now this, so an empty this predicate holds. Snow layers give snowballs with a shovel again and chorus flowers drop themselves. Explosions, pistons, mobs and fluids pass no entity, so these tables still give nothing there, as in vanilla. Every other entity_properties condition still fails.

Not touched: the armadillo scute (it does not use gift loot in Horizon) and the other gift tables, which have no entity conditions.

Vanilla reference

  • Chicken.aiStep calls dropFromGiftLootTable(level, CHICKEN_LAY, ...).
  • LivingEntity.dropFromGiftLootTable builds the context with THIS_ENTITY and ORIGIN (LootContextParamSets.GIFT).
  • data/minecraft/loot_table/gameplay/chicken_lay.json: entity_properties / this / minecraft:components minecraft:chicken/variant.
  • Block.playerDestroy and Block.getDrops pass the breaker as THIS_ENTITY.
  • data/minecraft/loot_table/blocks/snow.json, blocks/chorus_flower.json: entity_properties / this / {}.

Self-check

cargo check -p horizon-client passes.


🔄 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/2137 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/chicken-eggs` --- ### 📝 Commits (1) - [`6c7a90c`](https://github.com/horizon-rust/horizon/commit/6c7a90cd7e2f2627a06744392db5882de81660a0) Let chickens lay eggs and players get snow and chorus flowers from loot tables ### 📊 Changes **9 files changed** (+103 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+5 -4) 📝 `crates/horizon-client/src/game/creatures.rs` (+42 -9) 📝 `crates/horizon-client/src/game/explosion.rs` (+1 -0) 📝 `crates/horizon-client/src/items.rs` (+42 -3) 📝 `crates/horizon-client/src/mobs.rs` (+3 -1) 📝 `crates/horizon-client/src/mobs/drops.rs` (+3 -0) 📝 `crates/horizon-client/src/mobs/farm.rs` (+1 -0) 📝 `crates/horizon-client/src/mobs/sniffer.rs` (+1 -0) 📝 `crates/horizon-world/src/loot.rs` (+5 -0) </details> ### 📄 Description ## What and why Chickens never laid eggs, and breaking snow layers or a chorus flower gave nothing. Both come from the same gap: loot conditions of type `minecraft:entity_properties` always failed, because the loot context had no entity. Reproduced in game: 4 chickens, `/tick sprint 13000`, zero eggs. The egg sound played, but no item dropped. - **Chickens and gift loot.** `chicken_lay` is an `alternatives` of three egg items, each gated by `entity_properties` on `this` with the chicken's variant. `MobEvent::GiftLoot` now carries the mob id. The game rolls the table with `horizon_world::loot` (the engine the death loot already uses), from the table's random sequence, with the mob as `this`. `LootEntity` gets a `chicken_variant`, filled from the mob's variant, and the `minecraft:components` predicate understands `minecraft:chicken/variant`. Temperate chickens lay eggs, warm ones brown eggs, cold ones blue eggs. Sniffer digging uses the same path; its table has no conditions, so it behaves as before (it now also draws from its own random sequence). If the loot data is missing the old roll is used as a fallback. - **Snow and chorus flowers.** `snow.json` and `chorus_flower.json` require `entity_properties` for `this` with an empty predicate. When a player breaks a block (the local player and guests share `break_block_as_player`), the player is now `this`, so an empty `this` predicate holds. Snow layers give snowballs with a shovel again and chorus flowers drop themselves. Explosions, pistons, mobs and fluids pass no entity, so these tables still give nothing there, as in vanilla. Every other `entity_properties` condition still fails. Not touched: the armadillo scute (it does not use gift loot in Horizon) and the other gift tables, which have no entity conditions. ## Vanilla reference - `Chicken.aiStep` calls `dropFromGiftLootTable(level, CHICKEN_LAY, ...)`. - `LivingEntity.dropFromGiftLootTable` builds the context with `THIS_ENTITY` and `ORIGIN` (`LootContextParamSets.GIFT`). - `data/minecraft/loot_table/gameplay/chicken_lay.json`: `entity_properties` / `this` / `minecraft:components` `minecraft:chicken/variant`. - `Block.playerDestroy` and `Block.getDrops` pass the breaker as `THIS_ENTITY`. - `data/minecraft/loot_table/blocks/snow.json`, `blocks/chorus_flower.json`: `entity_properties` / `this` / `{}`. ## Self-check `cargo check -p horizon-client` passes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:14:12 +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#4039
No description provided.