[GH-ISSUE #4647] Native mods: a hook point for right-clicking an entity #1407

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

Originally created by @ludovicthenot on GitHub (Oct 30, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/4647

Originally assigned to: @ludovicthenot on GitHub.

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

Part of #3911 (Mods). Gap I of #1854 (item behaviour hooks) and next to #4290 (using an item), in the priority list of #4402: today a native mod can't react when a player right-clicks an entity. Items used on mobs (a wand, a capture tool, a mod's own lead or saddle), mobs a mod gives a right-click action, and entities that open a mod's screen all need it.

Proposal

A hook point in crates/horizon-client/src/game/native_hooks.rs, named after the vanilla call it sits in, as agreed on #4402:

/// A player right-clicks the entity `entity` of type `kind` with `self.hand`,
/// holding `stack`: where `Player.interactOn` starts. Set `claimed` to take
/// the click: the hand swings and neither the entity's `interact` nor the
/// item's `interactLivingEntity` runs.
pub(super) fn native_interact_entity(&mut self, entity: i32, kind: &str, stack: Option<&ItemStack>, claimed: &mut bool)
  • Called at the top of interact_entity (game.rs), on the entity the click targets (pick_entity_hit, its type from level_entity / target_type). Every player goes through it on the server (the integrated server thread, LAN guests through Interact, dedicated servers), once per hand as vanilla tries them.
  • Nothing changes without a native mod.
  • NATIVE_HOOKS_API + 1, its native-hooks.json entry, docs/native-mods.md.
Originally created by @ludovicthenot on GitHub (Oct 30, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/4647 Originally assigned to: @ludovicthenot on GitHub. > 🤖 Filed by ludovicthenot's AI agent (Claude Code, Claude Opus 5.5), not by ludovicthenot personally. Part of #3911 (Mods). Gap **I** of #1854 (item behaviour hooks) and next to #4290 (using an item), in the priority list of #4402: today a native mod can't react when a player right-clicks an entity. Items used on mobs (a wand, a capture tool, a mod's own lead or saddle), mobs a mod gives a right-click action, and entities that open a mod's screen all need it. ## Proposal A hook point in `crates/horizon-client/src/game/native_hooks.rs`, named after the vanilla call it sits in, as agreed on #4402: ```rust /// A player right-clicks the entity `entity` of type `kind` with `self.hand`, /// holding `stack`: where `Player.interactOn` starts. Set `claimed` to take /// the click: the hand swings and neither the entity's `interact` nor the /// item's `interactLivingEntity` runs. pub(super) fn native_interact_entity(&mut self, entity: i32, kind: &str, stack: Option<&ItemStack>, claimed: &mut bool) ``` - Called at the top of `interact_entity` (game.rs), on the entity the click targets (`pick_entity_hit`, its type from `level_entity` / `target_type`). Every player goes through it on the server (the integrated server thread, LAN guests through `Interact`, dedicated servers), once per hand as vanilla tries them. - Nothing changes without a native mod. - `NATIVE_HOOKS_API` + 1, its `native-hooks.json` entry, docs/native-mods.md.
Author
Owner

@ludovicthenot commented on GitHub (Oct 30, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6532612768 --> @ludovicthenot commented on GitHub (Oct 30, 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#1407
No description provided.