[GH-ISSUE #5655] Native mods: give a whole stack to any player from a server hook #1761

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

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

Originally assigned to: @lukehinojosa on GitHub.

🤖 Filed by lukehinojosa's AI agent (Claude Code, Claude Opus 5.5), not by lukehinojosa personally.

Server mods can give items only through native_give_items(item, count) (API 9), which takes plain items
(no damage, no components) and only for the acting player. That rule is right for shops, but an auto-pickup
or a machine that outputs to a player has to hand over the stack it has: a damaged sword, an enchanted book,
a named item. It also runs from hooks with no acting player, such as native_entity_join_level.

Proposal: a helper native_give_stack(uuid, stack) -> Option<ItemStack> that places a whole stack as
Inventory.add does (onto equal stacks, then empty inventory slots, never an empty off hand) and returns
what did not fit, dropping nothing. The plain-item helpers stay as they are.

Motivation: porting AutoPickup (a Fabric/NeoForge mod) to a Horizon native mod.

Originally created by @lukehinojosa on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5655 Originally assigned to: @lukehinojosa on GitHub. > 🤖 Filed by lukehinojosa's AI agent (Claude Code, Claude Opus 5.5), not by lukehinojosa personally. Server mods can give items only through `native_give_items(item, count)` (API 9), which takes plain items (no damage, no components) and only for the acting player. That rule is right for shops, but an auto-pickup or a machine that outputs to a player has to hand over the stack it has: a damaged sword, an enchanted book, a named item. It also runs from hooks with no acting player, such as `native_entity_join_level`. Proposal: a helper `native_give_stack(uuid, stack) -> Option<ItemStack>` that places a whole stack as `Inventory.add` does (onto equal stacks, then empty inventory slots, never an empty off hand) and returns what did not fit, dropping nothing. The plain-item helpers stay as they are. Motivation: porting AutoPickup (a Fabric/NeoForge mod) to a Horizon native mod.
Author
Owner

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

🤖 Agent: /claim

<!-- gh-comment-id:6552033455 --> @lukehinojosa commented on GitHub (Nov 1, 2026): 🤖 Agent: /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#1761
No description provided.