[PR #5780] [MERGED] Native mods: lead drops through native_loot_drops #6496

Closed
opened 2026-11-03 06:21:28 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5780
Author: @lukehinojosa
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @levzzz5154

Base: main ← Head: feat/native-lead-drops


📝 Commits (4)

  • cd12172 Native mods: lead drops through native_loot_drops
  • 5c0ee1e Merge #5763's branch (fixed) into the lead drops
  • 3892152 Lead killers: each level prunes only its own corpses
  • 08e7342 Merge remote-tracking branch 'hr/main' into pr-5780

📊 Changes

6 files changed (+75 additions, -9 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+5 -0)
📝 crates/horizon-client/src/game/creatures.rs (+3 -0)
📝 crates/horizon-client/src/game/leads.rs (+52 -6)
📝 crates/horizon-client/src/game/native_hooks.rs (+6 -2)
📝 docs/native-mods.md (+3 -1)
➕ tools/native-hook-fragments/lead_drops.json (+6 -0)

📄 Description

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

Closes #5766. Stacked on #5763 (it uses NativeLootDrops::used); the first commit is #5763's.

What and why

Leads dropped through break_leash, which spawned the item without telling native_loot_drops. Now:

  • Untying a lead the acting player holds, shears cutting a mob's lead, the leads it holds or every lead on
    a fence knot, and re-leashing a mob from another holder (its old lead drops) (leads.rs), go through
    break_leash_used: the lead passes through the hook with used, entity the leashed
    mob and the acting player.
  • A mob a player kills while leashed: LivingEntity.die records the killer (lead_killers, the same UUID the
    death loot names, only while the player-hurt memory lasts). The corpse still drops its lead on its next tick
    (Leashable.tickLeash), now as a call of its own with that killer, used false, no table. tick_leads forgets a
    corpse that went without dropping it.
  • Snapping, a lost holder (a broken fence's knot too, as vanilla) and every other break_leash caller name no
    player and drop as before (drop_lead_item, same motion draw).

Kept the vanilla timing (next tick, not folded into the death drops) so the drop order and draws stay as they are.

API number from the lead_drops fragment (no new hook; the contract stays at version 1).

Kind

  • extra: Horizon-only, off by default

Vanilla reference

Leashable.dropLeash, Leashable.tickLeash, Mob.checkAndHandleImportantInteractions,
Entity.shearOffAllLeashConnections.

Tests

None new: the change is the call sites. In-game proof below.

Proof

The AutoPickup test port (gives every player-named native_loot_drops stack with native_give_stack, #5661), built
with --profile fast on this branch plus #5661, #5748 and a local fix for #5678, driven with horizon-ctl in a fresh
survival world, a pig leashed each time:

  • right-click to untie → the lead in the inventory;
  • shears → the lead in the inventory;
  • killed with a diamond sword → the porkchop and the lead in the inventory, nothing on the ground;
  • the player teleported 20 blocks away so the lead snapped → the lead on the ground, not given (no player named).

A pig tied to a fence (summoned with leash: [I; x, y, z]):

  • shears on the knot → the lead in the inventory;
  • a new lead on the pig → the old lead back in the inventory and the new one used up;
  • the fence mined → the lead on the ground (no player named, as vanilla).

Not covered: leads on boats (they still drop as before), a mob's held leads being cut, a LAN guest on another machine, a dedicated server.

Self-check

Run on Windows (DESKTOP-LMH2005) against origin/main at 9cf948a10:

Check Result
Scope 5 files on top of #5763
rustfmt ✅
clippy --all-targets -D warnings ✅
tests: horizon-client (lib) ✅ 1114 passed
tests: horizon-client (bin) ⚠️ 488 passed, 1 failed: loot_table_load_stays_hookable, the CRLF failure on main too
Parity ➖ CI's parity job picks the affected harnesses

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/5780 **Author:** [@lukehinojosa](https://github.com/lukehinojosa) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `feat/native-lead-drops` --- ### 📝 Commits (4) - [`cd12172`](https://github.com/horizon-rust/horizon/commit/cd12172a8e9ecc668484a1b3b818ffda58db60ed) Native mods: lead drops through native_loot_drops - [`5c0ee1e`](https://github.com/horizon-rust/horizon/commit/5c0ee1ef23fb3124c9cade12c003838ec81d41ea) Merge #5763's branch (fixed) into the lead drops - [`3892152`](https://github.com/horizon-rust/horizon/commit/389215209106bb34521eec3fcce1a8db4fe144e1) Lead killers: each level prunes only its own corpses - [`08e7342`](https://github.com/horizon-rust/horizon/commit/08e734236d9d24a7128fac224bedda9d71fe371f) Merge remote-tracking branch 'hr/main' into pr-5780 ### 📊 Changes **6 files changed** (+75 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+5 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+3 -0) 📝 `crates/horizon-client/src/game/leads.rs` (+52 -6) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+6 -2) 📝 `docs/native-mods.md` (+3 -1) ➕ `tools/native-hook-fragments/lead_drops.json` (+6 -0) </details> ### 📄 Description > 🤖 Opened by lukehinojosa's AI agent (Claude Code, Claude Opus 5.5), not by lukehinojosa personally. Closes #5766. Stacked on #5763 (it uses `NativeLootDrops::used`); the first commit is #5763's. ## What and why Leads dropped through `break_leash`, which spawned the item without telling `native_loot_drops`. Now: - **Untying** a lead the acting player holds, **shears** cutting a mob's lead, the leads it holds or every lead on a fence knot, and **re-leashing** a mob from another holder (its old lead drops) (`leads.rs`), go through `break_leash_used`: the lead passes through the hook with `used`, `entity` the leashed mob and the acting player. - **A mob a player kills while leashed**: `LivingEntity.die` records the killer (`lead_killers`, the same UUID the death loot names, only while the player-hurt memory lasts). The corpse still drops its lead on its next tick (`Leashable.tickLeash`), now as a call of its own with that killer, `used` false, no table. `tick_leads` forgets a corpse that went without dropping it. - Snapping, a lost holder (a broken fence's knot too, as vanilla) and every other `break_leash` caller name no player and drop as before (`drop_lead_item`, same motion draw). Kept the vanilla timing (next tick, not folded into the death drops) so the drop order and draws stay as they are. API number from the `lead_drops` fragment (no new hook; the contract stays at version 1). ## Kind - [x] extra: Horizon-only, off by default ## Vanilla reference `Leashable.dropLeash`, `Leashable.tickLeash`, `Mob.checkAndHandleImportantInteractions`, `Entity.shearOffAllLeashConnections`. ## Tests None new: the change is the call sites. In-game proof below. ## Proof The AutoPickup test port (gives every player-named `native_loot_drops` stack with `native_give_stack`, #5661), built with `--profile fast` on this branch plus #5661, #5748 and a local fix for #5678, driven with horizon-ctl in a fresh survival world, a pig leashed each time: - right-click to untie → the lead in the inventory; - shears → the lead in the inventory; - killed with a diamond sword → the porkchop and the lead in the inventory, nothing on the ground; - the player teleported 20 blocks away so the lead snapped → the lead on the ground, not given (no player named). A pig tied to a fence (summoned with `leash: [I; x, y, z]`): - shears on the knot → the lead in the inventory; - a new lead on the pig → the old lead back in the inventory and the new one used up; - the fence mined → the lead on the ground (no player named, as vanilla). Not covered: leads on boats (they still drop as before), a mob's held leads being cut, a LAN guest on another machine, a dedicated server. ## Self-check Run on Windows (DESKTOP-LMH2005) against origin/main at 9cf948a10: | Check | Result | | --- | --- | | Scope | 5 files on top of #5763 | | rustfmt | ✅ | | clippy `--all-targets -D warnings` | ✅ | | tests: horizon-client (lib) | ✅ 1114 passed | | tests: horizon-client (bin) | ⚠️ 488 passed, 1 failed: `loot_table_load_stays_hookable`, the CRLF failure on main too | | Parity | ➖ CI's parity job picks the affected harnesses | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:21:28 +07:00
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#6496
No description provided.