[GH-ISSUE #6242] Native mods: equipment changes of mobs, LivingEquipmentChangeEvent #2031

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

Originally created by @levzzz5154 on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6242

Originally assigned to: @levzzz5154 on GitHub.

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

Part of #4953 ("Living: breathing, and equipment changes of mobs (a player's are heard by on_equip)"). This issue is the equipment half; breathing is its own issue.

Problem

native_on_equip tells a mod when a player's equipment slot takes a different item. A mod that reacts to what a mob wears or holds (a mod armour set's bonus on a zombie, a mob that picks up a mod item, a trader's stock) has no hook, and neither does a mod that wants to hear an armor stand dressed.

Vanilla and NeoForge

  • Vanilla: LivingEntity.tick (server side) calls detectEquipmentUpdates every tick, which runs collectEquipmentChanges: for each EquipmentSlot (main hand, off hand, feet, legs, chest, head, body, saddle) the current item is compared with lastEquipmentItems (starting empty, so a mob that spawns equipped counts as a change on its first tick) with ItemStack.matches.
  • NeoForge: LivingEquipmentChangeEvent(entity, slot, from, to) is posted inside that loop for each slot that changed. It cannot be cancelled.

Proposal

One server hook point, API from a fragment (tools/native-hook-fragments/living_equipment_change.json):

  • native_living_equipment_change(entity, kind, slot, from, to)

for mobs and armor stands (anything with vanilla's LivingEntity equipment that Horizon ticks on a server). entity is the entity's ID, kind its type, slot the EquipmentSlot name, from and to the stacks (none for empty). The game keeps each entity's last seen equipment and compares once a tick, after the mobs have ticked, as vanilla does; an entity new to the level counts from empty. Players keep native_on_equip (it also hears the paths that never reach a tick, such as /item). The hook only hears.

Originally created by @levzzz5154 on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6242 Originally assigned to: @levzzz5154 on GitHub. > 🤖 Filed by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally. Part of #4953 ("Living: breathing, and equipment changes of mobs (a player's are heard by `on_equip`)"). This issue is the equipment half; breathing is its own issue. ## Problem `native_on_equip` tells a mod when a *player's* equipment slot takes a different item. A mod that reacts to what a mob wears or holds (a mod armour set's bonus on a zombie, a mob that picks up a mod item, a trader's stock) has no hook, and neither does a mod that wants to hear an armor stand dressed. ## Vanilla and NeoForge - Vanilla: `LivingEntity.tick` (server side) calls `detectEquipmentUpdates` every tick, which runs `collectEquipmentChanges`: for each `EquipmentSlot` (main hand, off hand, feet, legs, chest, head, body, saddle) the current item is compared with `lastEquipmentItems` (starting empty, so a mob that spawns equipped counts as a change on its first tick) with `ItemStack.matches`. - NeoForge: `LivingEquipmentChangeEvent(entity, slot, from, to)` is posted inside that loop for each slot that changed. It cannot be cancelled. ## Proposal One server hook point, API from a fragment (`tools/native-hook-fragments/living_equipment_change.json`): - `native_living_equipment_change(entity, kind, slot, from, to)` for mobs and armor stands (anything with vanilla's `LivingEntity` equipment that Horizon ticks on a server). `entity` is the entity's ID, `kind` its type, `slot` the `EquipmentSlot` name, `from` and `to` the stacks (none for empty). The game keeps each entity's last seen equipment and compares once a tick, after the mobs have ticked, as vanilla does; an entity new to the level counts from empty. Players keep `native_on_equip` (it also hears the paths that never reach a tick, such as `/item`). The hook only hears.
Author
Owner

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

/claim

<!-- gh-comment-id:6562000988 --> @levzzz5154 commented on GitHub (Nov 1, 2026): /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#2031
No description provided.