[GH-ISSUE #6199] Native mods: a block's drops don't reach a mod's loot function #2009

Closed
opened 2026-11-02 15:51:19 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @arismoko on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6199

Originally assigned to: @MSedgeMC on GitHub.

🤖 Filed by Aria's agent swarm, Dyna, not by Aria.

#6142 lets a loot table use a function of a mod's own kind (native_loot_function), but only in the main loot engine. The items engine rolls block drops, entity drops, loot_table and interact loot, and it never calls the function hook. So a block's own drops can't use a mod function, for example to copy a machine's contents or settings into the dropped item. #5451 asked for that use, and #6142 closed it.

Where, on main at 1bd24e4042:

  • The items engine's modifiers (crates/horizon-items/src/items.rs:1713) has no mod-kind arm. Its comment at lines 1554-1556 notes "the function hook isn't here yet", because this engine has no LootStack.
  • The function dispatch exists only in crates/horizon-world/src/loot.rs:1577-1578.
  • docs/native-mods.md (near line 428) documents the limit.

Seen in game during the review of #6142, at f7bff20187, with a throwaway horizon-machine-sample branch on the server thread and on a local dedicated server with a client joined. The block's loot table had a mod function on its entry that set the count to seven. Breaking the block dropped one item.

How to test: horizon-machine-sample is the recommended route. Give a mod block's loot table an entry function of the mod's own kind, claim it in native_loot_function, and break the block.

Originally created by @arismoko on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6199 Originally assigned to: @MSedgeMC on GitHub. > 🤖 Filed by Aria's agent swarm, Dyna, not by Aria. #6142 lets a loot table use a function of a mod's own kind (`native_loot_function`), but only in the main loot engine. The items engine rolls block drops, entity drops, `loot_table` and interact loot, and it never calls the function hook. So a block's own drops can't use a mod function, for example to copy a machine's contents or settings into the dropped item. #5451 asked for that use, and #6142 closed it. **Where, on main at `1bd24e4042`:** - The items engine's `modifiers` (`crates/horizon-items/src/items.rs:1713`) has no mod-kind arm. Its comment at lines 1554-1556 notes "the function hook isn't here yet", because this engine has no `LootStack`. - The function dispatch exists only in `crates/horizon-world/src/loot.rs:1577-1578`. - `docs/native-mods.md` (near line 428) documents the limit. **Seen in game** during [the review of #6142](https://github.com/horizon-rust/horizon/pull/6142#pullrequestreview-5729445353), at `f7bff20187`, with a throwaway [horizon-machine-sample](https://github.com/arismoko/horizon-machine-sample) branch on the server thread and on a local dedicated server with a client joined. The block's loot table had a mod function on its entry that set the count to seven. Breaking the block dropped one item. **How to test:** horizon-machine-sample is the recommended route. Give a mod block's loot table an entry function of the mod's own kind, claim it in `native_loot_function`, and break the block.
Author
Owner

@MSedgeMC commented on GitHub (Nov 1, 2026):

/claim

<!-- gh-comment-id:6564677567 --> @MSedgeMC commented on GitHub (Nov 1, 2026): /claim
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#2009
No description provided.