[GH-ISSUE #5029] Native mods: read and take a block's items through a side, and move them between blocks #1526

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

Originally created by @Qwerner88880 on GitHub (Oct 31, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5029

Originally assigned to: @Qwerner88880 on GitHub.

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

Part of #4953 ("Capabilities": the item handler on blocks comes first) and #3911 (Mods).

A native mod can put items into a block (native_insert_item, API 20) but can't read or take them. So a pipe or a machine that pulls from a chest or a furnace has to know every block entity's slots and rules itself, and a move can lose items when the target is full and the source won't take them back.

What I plan, as helpers with no new hook points:

  • native_container_slots(dimension, pos, face): the slots open through a side, each with its stack and whether it can be taken, by the rules hoppers use (WorldlyContainer, double chests, a mod's ModContainer).
  • native_extract_item(dimension, pos, face, slot, count): takes up to count from a slot through a side.
  • native_move_items(dimension, from, from_face, to, to_face, item, max): moves items between two containers, as a hopper does: a refused item goes back to its slot.

Two bugs in the same path get fixed with them:

  • native_insert_item overfills an empty slot: the whole stack goes in, so 64 ender pearls make one stack of 64. Vanilla's tryMoveInItem does the same, but a hopper only ever hands it one item.
  • A machine inserting into itself during its own tick loses the items: it's out of the world during the call, so they land on the placeholder that the tick then overwrites.

Not in this: fluids, energy, container entities such as minecarts, and a composter's bone meal, which only a hopper takes for now.

Originally created by @Qwerner88880 on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5029 Originally assigned to: @Qwerner88880 on GitHub. > 🤖 Filed by Qwerner88880's AI agent (Claude Code, Claude Opus 5.5), not by Qwerner88880 personally. Part of #4953 ("Capabilities": the item handler on blocks comes first) and #3911 (Mods). A native mod can put items into a block (`native_insert_item`, API 20) but can't read or take them. So a pipe or a machine that pulls from a chest or a furnace has to know every block entity's slots and rules itself, and a move can lose items when the target is full and the source won't take them back. What I plan, as helpers with no new hook points: - **`native_container_slots(dimension, pos, face)`:** the slots open through a side, each with its stack and whether it can be taken, by the rules hoppers use (`WorldlyContainer`, double chests, a mod's `ModContainer`). - **`native_extract_item(dimension, pos, face, slot, count)`:** takes up to `count` from a slot through a side. - **`native_move_items(dimension, from, from_face, to, to_face, item, max)`:** moves items between two containers, as a hopper does: a refused item goes back to its slot. Two bugs in the same path get fixed with them: - **`native_insert_item` overfills an empty slot:** the whole stack goes in, so 64 ender pearls make one stack of 64. Vanilla's `tryMoveInItem` does the same, but a hopper only ever hands it one item. - **A machine inserting into itself during its own tick loses the items:** it's out of the world during the call, so they land on the placeholder that the tick then overwrites. Not in this: fluids, energy, container entities such as minecarts, and a composter's bone meal, which only a hopper takes for now.
Author
Owner

@Qwerner88880 commented on GitHub (Oct 31, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6541085065 --> @Qwerner88880 commented on GitHub (Oct 31, 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#1526
No description provided.