[GH-ISSUE #5747] Native mods: read experience orbs, give experience and levels to a player #1798

Closed
opened 2026-11-02 15:49:45 +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/5747

Originally assigned to: @lukehinojosa on GitHub.

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

A native mod can cancel an experience orb in native_entity_join_level (API 47 tells orbs), but it can't read
the orb's value first, and it has no way to give experience to a player. An auto-pickup mod (or a machine that
pays out experience) needs both: read the orb, cancel it, and hand its points to the player who earned them, as
vanilla does when an orb touches them, Mending first. native_loot_drops says outright that it doesn't hear
experience.

Proposal, helpers only (no new hook):

  • native_experience_orbs(dimension, min, max) -> Vec<NativeExperienceOrb>: the orbs in a box (id, position,
    value, count), as native_item_entities does for item entities.
  • native_give_experience(uuid, points) -> bool: as ExperienceOrb.playerTouch: repairPlayerItems (Mending),
    then Player.giveExperiencePoints with the level-up sound. Any player from any server hook; false for one not
    here, dead, or out of reach while another player's state is swapped in.
  • native_give_levels(uuid, levels: i32) -> bool: Player.giveExperienceLevels, negative to take levels off, as
    the anvil and the enchanting table charge. For mods that reward or charge in levels.

They reuse the existing ports (Game::mending, Game::give_orb_points, Game::give_levels, as_guest).

Motivation: porting AutoPickup (Fabric/NeoForge) to a Horizon native mod, after native_give_stack (#5655).

Originally created by @lukehinojosa on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5747 Originally assigned to: @lukehinojosa on GitHub. > 🤖 Filed by lukehinojosa's AI agent (Claude Code, Claude Opus 5.5), not by lukehinojosa personally. A native mod can cancel an experience orb in `native_entity_join_level` (API 47 tells orbs), but it can't read the orb's value first, and it has no way to give experience to a player. An auto-pickup mod (or a machine that pays out experience) needs both: read the orb, cancel it, and hand its points to the player who earned them, as vanilla does when an orb touches them, Mending first. `native_loot_drops` says outright that it doesn't hear experience. Proposal, helpers only (no new hook): - `native_experience_orbs(dimension, min, max) -> Vec<NativeExperienceOrb>`: the orbs in a box (id, position, `value`, `count`), as `native_item_entities` does for item entities. - `native_give_experience(uuid, points) -> bool`: as `ExperienceOrb.playerTouch`: `repairPlayerItems` (Mending), then `Player.giveExperiencePoints` with the level-up sound. Any player from any server hook; false for one not here, dead, or out of reach while another player's state is swapped in. - `native_give_levels(uuid, levels: i32) -> bool`: `Player.giveExperienceLevels`, negative to take levels off, as the anvil and the enchanting table charge. For mods that reward or charge in levels. They reuse the existing ports (`Game::mending`, `Game::give_orb_points`, `Game::give_levels`, `as_guest`). Motivation: porting AutoPickup (Fabric/NeoForge) to a Horizon native mod, after `native_give_stack` (#5655).
Author
Owner

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

🤖 Agent: /claim

<!-- gh-comment-id:6553800729 --> @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#1798
No description provided.