[PR #2376] [MERGED] Trial chamber mobs spawn with the gear their spawner's equipment table gives #4257

Closed
opened 2026-11-03 04:15:50 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2376
Author: @kacpherek
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: fix/trial-mob-equipment


📝 Commits (2)

  • f1181d4 Trial chamber mobs spawn with the gear their spawner's equipment table gives
  • 9a9de6a Merge remote-tracking branch 'origin/main' into HEAD

📊 Changes

5 files changed (+124 additions, -11 deletions)

View changed files

📝 crates/horizon-client/src/game/mob_gear.rs (+56 -0)
📝 crates/horizon-client/src/game/spawner.rs (+17 -10)
📝 crates/horizon-client/src/game/trial_spawner.rs (+1 -1)
📝 crates/horizon-client/src/mobs/finalize.rs (+22 -0)
📝 crates/horizon-client/src/mobs/spawner.rs (+28 -0)

📄 Description

What and why

Mobs from ominous trial spawners (zombies, husks, skeletons, bogged) spawned bare-handed. Their spawn data has an equipment entry (minecraft:equipment/trial_chamber_melee and trial_chamber_ranged, with slot_drop_chances), but Horizon only kept it as NBT on the spawner and never rolled the loot table. They now get the rolled sword, bow or armour, with the enchantments the table sets and the slot drop chances from the spawn data (0 for the trial chamber ones, so the gear does not drop).

Spawner mobs (monster spawners and trial spawners, normal and ominous) go through the same path, so any custom spawner with equipment works too. Armour trims from set_components are not shown; the loot engine does not model components.

Vanilla reference

  • BaseSpawner.serverTick and TrialSpawner.spawnMob: nextSpawnData.getEquipment().ifPresent(mob::equip), after finalizeSpawn.
  • Mob.equip(EquipmentTable) and createEquipmentParams (origin and this entity).
  • EquipmentUser.equip / resolveSlot: an equippable item goes to its own slot, anything else to the main hand, each slot once; the slot's drop chance is set when the table names it.
  • EquipmentTable.CODEC: slot_drop_chances is a single number for every slot or a map by slot name.
  • LootTable.getRandomItems with the table's random sequence.

Self-check

cargo check -p horizon-client passes.


🔄 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/2376 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/trial-mob-equipment` --- ### 📝 Commits (2) - [`f1181d4`](https://github.com/horizon-rust/horizon/commit/f1181d4a250b8d1a76dadfbadbbf714642492e17) Trial chamber mobs spawn with the gear their spawner's equipment table gives - [`9a9de6a`](https://github.com/horizon-rust/horizon/commit/9a9de6a936cd1436dc3bd5b44839a7cef31022de) Merge remote-tracking branch 'origin/main' into HEAD ### 📊 Changes **5 files changed** (+124 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/mob_gear.rs` (+56 -0) 📝 `crates/horizon-client/src/game/spawner.rs` (+17 -10) 📝 `crates/horizon-client/src/game/trial_spawner.rs` (+1 -1) 📝 `crates/horizon-client/src/mobs/finalize.rs` (+22 -0) 📝 `crates/horizon-client/src/mobs/spawner.rs` (+28 -0) </details> ### 📄 Description ## What and why Mobs from ominous trial spawners (zombies, husks, skeletons, bogged) spawned bare-handed. Their spawn data has an `equipment` entry (`minecraft:equipment/trial_chamber_melee` and `trial_chamber_ranged`, with `slot_drop_chances`), but Horizon only kept it as NBT on the spawner and never rolled the loot table. They now get the rolled sword, bow or armour, with the enchantments the table sets and the slot drop chances from the spawn data (0 for the trial chamber ones, so the gear does not drop). Spawner mobs (monster spawners and trial spawners, normal and ominous) go through the same path, so any custom spawner with `equipment` works too. Armour trims from `set_components` are not shown; the loot engine does not model components. ## Vanilla reference - `BaseSpawner.serverTick` and `TrialSpawner.spawnMob`: `nextSpawnData.getEquipment().ifPresent(mob::equip)`, after `finalizeSpawn`. - `Mob.equip(EquipmentTable)` and `createEquipmentParams` (origin and `this` entity). - `EquipmentUser.equip` / `resolveSlot`: an `equippable` item goes to its own slot, anything else to the main hand, each slot once; the slot's drop chance is set when the table names it. - `EquipmentTable.CODEC`: `slot_drop_chances` is a single number for every slot or a map by slot name. - `LootTable.getRandomItems` with the table's random sequence. ## Self-check `cargo check -p horizon-client` passes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:15:50 +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#4257
No description provided.