[GH-ISSUE #5552] Native helpers for machines: break with drops, move item entities, the targeted block, text in the world #1730

Open
opened 2026-11-02 15:49:14 +07:00 by bsakaguchi · 0 comments
Owner

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

Summary

Four small helpers that machine mods keep needing, each missing from the hook points on main:

  1. Break a block as a tool would: its loot-table drops, the tool's enchantments, and crack progress shown to players while it breaks.
  2. Set an item entity's velocity or position.
  3. On the client, the block (and face) under the player's crosshair.
  4. Text drawn in world space, facing a direction or the camera.

Why

  • Breaking: block breakers, drills and miners (Create's drill and saw, Mekanism's Digital Miner, Industrial Foregoing's Block Breaker, Cyclic). native_destroy_block (API 14) hears a player breaking a block, and native_set_block can set air, but nothing breaks a block with its drops or shows the cracks.
  • Item entities: fans and conveyors push items (Create's encased fan, Immersive Engineering's conveyor belts), magnets pull them (Simple Magnets, Cyclic). API 42 reads item entities near a block and sets their stack, not their motion; native_push_mob covers mobs only.
  • Targeted block: overlays that show a machine's state when you look at it (Create's goggles: speed and stress; Botania's wand of the forest HUD). Today a mod casts its own ray from the player's yaw and pitch.
  • Text in the world: Storage Drawers' item counts, Applied Energistics 2's storage monitor, Create's value boxes.

Proposal

  • native_break_block(level, pos, tool: Option<&ItemStack>, drop_at: Option<[f64; 3]>) -> Vec<ItemStack> and native_set_break_progress(level, pos, id, stage) (Level.destroyBlockProgress).
  • native_set_item_entity_motion(level, id, velocity) next to native_set_item_entity.
  • native_target_block() -> Option<(BlockPos, Direction, [f64; 3])> on the client.
  • A text item for the block-entity drawing hook (#5548, or native_world_drawn): string, font, position, rotation, scale, colour, light.

How I did it on my fork

My fork does each inside the engine for my Create port: drill and saw in kinetic_machines.rs and saws.rs (1dcc794d9, fc079f75e), item pushing in fans.rs, the corner box with block, speed and stress in game/kinetics.rs (11b987972).

Originally created by @JuanLuci on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5552 ## Summary Four small helpers that machine mods keep needing, each missing from the hook points on main: 1. Break a block as a tool would: its loot-table drops, the tool's enchantments, and crack progress shown to players while it breaks. 2. Set an item entity's velocity or position. 3. On the client, the block (and face) under the player's crosshair. 4. Text drawn in world space, facing a direction or the camera. ## Why - Breaking: block breakers, drills and miners (Create's drill and saw, Mekanism's Digital Miner, Industrial Foregoing's Block Breaker, Cyclic). `native_destroy_block` (API 14) hears a player breaking a block, and `native_set_block` can set air, but nothing breaks a block with its drops or shows the cracks. - Item entities: fans and conveyors push items (Create's encased fan, Immersive Engineering's conveyor belts), magnets pull them (Simple Magnets, Cyclic). API 42 reads item entities near a block and sets their stack, not their motion; `native_push_mob` covers mobs only. - Targeted block: overlays that show a machine's state when you look at it (Create's goggles: speed and stress; Botania's wand of the forest HUD). Today a mod casts its own ray from the player's yaw and pitch. - Text in the world: Storage Drawers' item counts, Applied Energistics 2's storage monitor, Create's value boxes. ## Proposal - `native_break_block(level, pos, tool: Option<&ItemStack>, drop_at: Option<[f64; 3]>) -> Vec<ItemStack>` and `native_set_break_progress(level, pos, id, stage)` (`Level.destroyBlockProgress`). - `native_set_item_entity_motion(level, id, velocity)` next to `native_set_item_entity`. - `native_target_block() -> Option<(BlockPos, Direction, [f64; 3])>` on the client. - A text item for the block-entity drawing hook (#5548, or `native_world_drawn`): string, font, position, rotation, scale, colour, light. ## How I did it on my fork My fork does each inside the engine for my Create port: drill and saw in `kinetic_machines.rs` and `saws.rs` ([1dcc794d9](https://github.com/JuanLuci/starling/commit/1dcc794d9), [fc079f75e](https://github.com/JuanLuci/starling/commit/fc079f75e)), item pushing in `fans.rs`, the corner box with block, speed and stress in `game/kinetics.rs` ([11b987972](https://github.com/JuanLuci/starling/commit/11b987972)).
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#1730
No description provided.