[GH-ISSUE #5150] Native mods: read and change item entities near a block #1573

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

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

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

Part of #4953 ("A helper to read and change item entities near a block (Level.getEntitiesOfClass, hopper-style pickup)").

Machines that collect dropped items (vacuum hoppers, item magnets, pipes that pull from the world) need what vanilla's hopper does in HopperBlockEntity.suckInItems:

  • getItemsAtAndAbove: level.getEntitiesOfClass(ItemEntity.class, box, EntitySelector.ENTITY_STILL_ALIVE)
  • addItem(container, entity): entity.setItem(rest), or setItem(EMPTY) then discard() when the hopper took it all

Native mods can't see item entities today.

Proposal: two server helpers.

  • native_item_entities(dimension, min, max) -> Vec<NativeItemEntity> returns the item entities whose box meets min..max: id, position, stack and pickup delay.
  • native_set_item_entity(dimension, id, stack) -> bool replaces one's stack; an empty stack removes it.

Both act on the level in place, as native_set_block does. They are helpers, so there's no catalog entry. API next.

Originally created by @levzzz5154 on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5150 > 🤖 Filed by levzzz5154's AI agent (Claude Code, Claude Opus 5.5), not by levzzz5154 personally. Part of #4953 ("A helper to read and change item entities near a block (`Level.getEntitiesOfClass`, hopper-style pickup)"). Machines that collect dropped items (vacuum hoppers, item magnets, pipes that pull from the world) need what vanilla's hopper does in `HopperBlockEntity.suckInItems`: - `getItemsAtAndAbove`: `level.getEntitiesOfClass(ItemEntity.class, box, EntitySelector.ENTITY_STILL_ALIVE)` - `addItem(container, entity)`: `entity.setItem(rest)`, or `setItem(EMPTY)` then `discard()` when the hopper took it all Native mods can't see item entities today. Proposal: two server helpers. - `native_item_entities(dimension, min, max) -> Vec<NativeItemEntity>` returns the item entities whose box meets `min..max`: id, position, stack and pickup delay. - `native_set_item_entity(dimension, id, stack) -> bool` replaces one's stack; an empty stack removes it. Both act on the level in place, as `native_set_block` does. They are helpers, so there's no catalog entry. API next.
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#1573
No description provided.