[PR #5566] [MERGED] Native mods: an enchantment's effect of a mod's own kind (post_attack) #6357

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5566
Author: @Qwerner88880
Created: 10/31/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: hooks-enchant


📝 Commits (4)

  • f074c2d Native mods: an enchantment's effect of a mod's own kind
  • 36b0d26 Native mods: enchant_effect honours requirements and names the mob hit
  • cd39ec5 Merge main into #5566 (both hook sections kept)
  • d2ad79e Merge remote-tracking branch 'origin/main' into n5566

📊 Changes

4 files changed (+59 additions, -9 deletions)

View changed files

📝 crates/horizon-client/src/game/enchant_effects.rs (+21 -9)
📝 crates/horizon-client/src/game/native_hooks.rs (+19 -0)
📝 docs/native-mods.md (+9 -0)
➕ tools/native-hook-fragments/enchant_effect.json (+10 -0)

📄 Description

🤖 Opened by Qwerner88880's AI agent (ZCode, GLM-5.3), not by Qwerner88880 personally.

What and why

Fixes #5449. Part of #4953 ("More content registration") and #3911 (Mods).

An enchantment's effects entry that names an effect.type in a namespace outside minecraft: used to be silently skipped at the firing point — the enchantment kept working for its vanilla effects, but the mod's own was dead data. It now reaches native_enchant_effect(enchantment, kind, data, level) at the effect's firing point, starting with the post_attack components (the weapon's holder is the acting player). The game's own damage, sounds, effects and drops are open to the hook; an unclaimed kind does nothing.

Scope of this first cut: the post_attack component, attacker→victim entries only (the weapon's holder is the acting player, the hook gets the mob hit). attacker→attacker entries and the other firing points (damage, tick, location_changed, hit_block) stay the game's until they get their own arm in follow-ups. (Scope line corrected by Ludovic's AI agent after rdbtCVS's re-review.)

Kind

  • feature: something new for players (listed under New in the release notes)
  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • tooling
  • docs

Vanilla reference

Vanilla 26.3 dispatches enchantment effect kinds through Registries.ENCHANTMENT_ENTITY_EFFECT_TYPE (jar-checked: EnchantmentEffectComponents and Registries), where a mod platform registers its own kind. The hook is the game's stand-in for that registration; the component keys (minecraft:post_attack, ...) are fixed firing points, as vanilla's DataComponentTypes are.

Other projects' code

none

Tests

Unit: none — the hook is a no-op without a bundle, and the parse path needs no change (the effects are raw JSON already; the filter is at dispatch, not load).

Live: not run — the hook needs a bundle with a weapon carrying a custom enchantment effect, which requires an enchantment definition from a content mod plus the mixin bundle. Same setup as #5558's consume proof; running next.

Not verified: the value-effect components (damage, knockback) — the modify_value path in horizon-items runs below the hook layer and needs its own threading, which is the next follow-up.

Self-check

Check Result
Scope ✅ 4 files, +60 −7
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 510 passed (58 s)
rustfmt ✅ (8 s)
clippy ✅ (53 s)
tests: horizon-client ✅ 1573 passed (1 min 50 s)
doc tests ✅ 0 passed (3 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with ZCode (GLM-5.3)


🔄 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/5566 **Author:** [@Qwerner88880](https://github.com/Qwerner88880) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `hooks-enchant` --- ### 📝 Commits (4) - [`f074c2d`](https://github.com/horizon-rust/horizon/commit/f074c2d4bd5da781608b77a2f6c2bba072b136b9) Native mods: an enchantment's effect of a mod's own kind - [`36b0d26`](https://github.com/horizon-rust/horizon/commit/36b0d2670f99fb8e9963c5608a9811186340a58d) Native mods: enchant_effect honours requirements and names the mob hit - [`cd39ec5`](https://github.com/horizon-rust/horizon/commit/cd39ec5fdcaa3d3287d13f5b002101c7f9ff6850) Merge main into #5566 (both hook sections kept) - [`d2ad79e`](https://github.com/horizon-rust/horizon/commit/d2ad79e4c1d7c6b13e5ca003fab430c3919b893d) Merge remote-tracking branch 'origin/main' into n5566 ### 📊 Changes **4 files changed** (+59 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/enchant_effects.rs` (+21 -9) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+19 -0) 📝 `docs/native-mods.md` (+9 -0) ➕ `tools/native-hook-fragments/enchant_effect.json` (+10 -0) </details> ### 📄 Description > 🤖 Opened by Qwerner88880's AI agent (ZCode, GLM-5.3), not by Qwerner88880 personally. ## What and why Fixes #5449. Part of #4953 ("More content registration") and #3911 (Mods). An enchantment's `effects` entry that names an `effect.type` in a namespace outside `minecraft:` used to be silently skipped at the firing point — the enchantment kept working for its vanilla effects, but the mod's own was dead data. It now reaches `native_enchant_effect(enchantment, kind, data, level)` at the effect's firing point, starting with the `post_attack` components (the weapon's holder is the acting player). The game's own damage, sounds, effects and drops are open to the hook; an unclaimed kind does nothing. **Scope of this first cut:** the `post_attack` component, `attacker`→`victim` entries only (the weapon's holder is the acting player, the hook gets the mob hit). `attacker`→`attacker` entries and the other firing points (damage, tick, location_changed, hit_block) stay the game's until they get their own arm in follow-ups. _(Scope line corrected by Ludovic's AI agent after rdbtCVS's re-review.)_ ## Kind - [x] feature: something new for players (listed under New in the release notes) - [ ] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] tooling - [ ] docs ## Vanilla reference Vanilla 26.3 dispatches enchantment effect kinds through `Registries.ENCHANTMENT_ENTITY_EFFECT_TYPE` (jar-checked: `EnchantmentEffectComponents` and `Registries`), where a mod platform registers its own kind. The hook is the game's stand-in for that registration; the component keys (`minecraft:post_attack`, ...) are fixed firing points, as vanilla's `DataComponentType`s are. ## Other projects' code none ## Tests **Unit:** none — the hook is a no-op without a bundle, and the parse path needs no change (the effects are raw JSON already; the filter is at dispatch, not load). **Live:** not run — the hook needs a bundle with a weapon carrying a custom enchantment effect, which requires an enchantment definition from a content mod plus the mixin bundle. Same setup as #5558's consume proof; running next. **Not verified:** the value-effect components (damage, knockback) — the `modify_value` path in `horizon-items` runs below the hook layer and needs its own threading, which is the next follow-up. ## Self-check | Check | Result | | --- | --- | | Scope | ✅ 4 files, +60 −7 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 510 passed (58 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (53 s) | | tests: horizon-client | ✅ 1573 passed (1 min 50 s) | | doc tests | ✅ 0 passed (3 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with ZCode (GLM-5.3) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:19:10 +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#6357
No description provided.