[PR #175] [MERGED] Maces: smash attacks, Density, Breach, Wind Burst #2377

Closed
opened 2026-11-02 15:55:28 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/175
Author: @ludovic111
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @ludovic111

Base: main ← Head: fix/maces-105


📝 Commits (1)

  • 56aae0e Maces smash: fall damage bonus, Density, Breach, Wind Burst, knockback

📊 Changes

19 files changed (+1174 additions, -96 deletions)

View changed files

📝 crates/horizon-client/src/enchant.rs (+34 -1)
📝 crates/horizon-client/src/game.rs (+40 -38)
📝 crates/horizon-client/src/game/commands/world_cmds.rs (+1 -0)
📝 crates/horizon-client/src/game/creatures.rs (+1 -0)
📝 crates/horizon-client/src/game/dispense_fixture.rs (+138 -3)
📝 crates/horizon-client/src/game/enchant_effects.rs (+63 -0)
📝 crates/horizon-client/src/game/explosion.rs (+83 -34)
➕ crates/horizon-client/src/game/mace.rs (+330 -0)
📝 crates/horizon-client/src/game/sculk.rs (+13 -0)
📝 crates/horizon-client/src/game/wind.rs (+48 -16)
📝 crates/horizon-client/src/items.rs (+7 -0)
📝 crates/horizon-client/src/mobs.rs (+27 -3)
📝 crates/horizon-client/src/mobs/creaking.rs (+1 -0)
📝 crates/horizon-client/src/mobs/guardian.rs (+4 -1)
📝 crates/horizon-client/src/mobs/sulfur_cube.rs (+1 -0)
📝 crates/horizon-client/src/motion.rs (+20 -0)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockUpdateOracle.java (+2 -0)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDispenserOracle.java (+157 -0)
➕ tools/test_mace_parity.py (+204 -0)

📄 Description

What was wrong

A mace hit like any other weapon: no smash attack after a fall, no extra damage for the height fallen, no stopped fall (players took the full fall damage after a smash), no knockback around the target, no smash sounds or dust. Density, Breach and Wind Burst did nothing.

What vanilla does (26.3)

  • MaceItem.getAttackDamageBonus: when fallDistance > 1.5 and not gliding, 4 per block for the first 3 blocks, 2 for the next 5, 1 after that, plus EnchantmentHelper.modifyFallBasedDamage (Density's smash_damage_per_fallen_block) × fall distance, added before the critical hit. getItemDamageSource makes the hit mace_smash damage.
  • MaceItem.hurtEnemy: the attacker's Y velocity becomes 0.01F, fall damage is waived from the impact point (setIgnoreFallDamageFromCurrentImpulse, 40-tick grace), item.mace.smash_ground(_heavy) (fall > 5) or smash_air at the player, ServerPlayer.spawnExtraParticlesOnFall (block particles on landing, 50 per block fallen), level event 2013 (dust pillars) under the target, and every living entity within 3.5 blocks of the target pushed by (3.5 − d) × 0.7F × (2 if fall > 5) × (1 − knockback resistance) and 0.7F up. The player's allies (isAlliedTo: pets it tamed, allays that like it), spectators, marker armor stands and creative flyers are spared. postHurtEnemy resets the fall distance.
  • Breach: CombatRules.getDamageAfterAbsorb runs the weapon's armor_effectiveness effects over the armor fraction, clamped to [0, 1].
  • Wind Burst: a post_attack ExplodeEffect on the attacker (radius 3.5, trigger, knockback 1.2 / 1.75 / 2.2), only when the attacker has fallen at least 1.5 blocks and isn't flying.
  • ItemStack.hurtEnemy / postHurtEnemy: weapons award the used statistic and wear by weapon.item_damage_per_attack (axes and pickaxes 2, swords and maces 1, no wear in creative, none for non-weapons).

Smaller vanilla details matched along the way, all exercised by the harness:

  • dealDefaultKnockback is 0.4F, not 0.4, and reads the live knockback-resistance attribute.
  • ServerExplosion.getSeenPercent now uses the exact COLLIDER clip (clip_world), not a 0.1-step approximation over full cubes. This affected entities overlapping blocks.
  • Bursts post the explode game event first. ServerPlayer.onExplosionHit keeps the fall waived only for a wind charge's burst (any thrower, dispensers included); any other burst ends the impulse grace.
  • Visible armor stands feel bursts that affect block-like entities (Wind Burst; never a wind charge's).
  • Attack sounds play at the player. Mob hurt sounds play where the mob stands. damage_dealt and the damage-indicator hearts use the damage actually dealt. A hit that does nothing plays attack.nodamage. A critical hit needs fallDistance > 0.

How it was tested

tools/test_mace_parity.py (new) adds an attack case to VanillaDispenserOracle: a stand-in ServerPlayer hits a real target over the headless level. It runs getAttackDamageBonus, hurtServer (armor + Breach), hurtEnemy, EnchantmentHelper.doPostAttackEffectsWithItemSource (a real ServerExplosion for Wind Burst) and postHurtEnemy. Horizon's fixture runs the helpers Game::attack itself uses (smash_damage_bonus, hurt_by_player, weapon_hit). Cases vary the fall (including the 1.5 / 3 / 5 / 8 thresholds), gliding and flying, earlier impact points, Density / Breach / Wind Burst / Unbreaking mixes, swords, axes, pickaxes, sticks and empty hands, armored targets, knockback resistance, mobs and armor stands (markers too) around the target, and walls.

Results:

  • mace harness: 3000/3000 (1660 smashes, 589 Wind Bursts). It compares every target's health and velocity, the player's velocity, fall distance, impact point, grace time and landing-particle flag, sounds, level and game events, statistics, the held stack and the level random.
  • Dispenser harness: 6000/6000.
  • Use-item-on harness: 4000/4000.
  • cargo test -p horizon-client: all pass.
  • cargo clippy --workspace --all-targets -D warnings, cargo fmt --check and tools/check_public_tree.py: clean.

In game (Linux build on a virtual screen, survival): dropping about 10 blocks onto an iron golem with a plain mace took it from 100 to 55.5 HP (6 base + the fall bonus, ×1.5 critical). The player took no fall damage. Two cows 2 blocks away were thrown about 6 blocks out and up, and the smash dust showed. With Wind Burst III, the same hit launched the player from y≈102 to y≈124.

Not modelled, unchanged: the player_hurt_entity advancement trigger (Over-Overkill), knockback of LAN guests near the target, and scoreboard-team alliances for mobs.

Fixes #105

🤖 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/175 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/maces-105` --- ### 📝 Commits (1) - [`56aae0e`](https://github.com/horizon-rust/horizon/commit/56aae0e9023609cbc1efaa1e59f3e6fd60fe9968) Maces smash: fall damage bonus, Density, Breach, Wind Burst, knockback ### 📊 Changes **19 files changed** (+1174 additions, -96 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/enchant.rs` (+34 -1) 📝 `crates/horizon-client/src/game.rs` (+40 -38) 📝 `crates/horizon-client/src/game/commands/world_cmds.rs` (+1 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+1 -0) 📝 `crates/horizon-client/src/game/dispense_fixture.rs` (+138 -3) 📝 `crates/horizon-client/src/game/enchant_effects.rs` (+63 -0) 📝 `crates/horizon-client/src/game/explosion.rs` (+83 -34) ➕ `crates/horizon-client/src/game/mace.rs` (+330 -0) 📝 `crates/horizon-client/src/game/sculk.rs` (+13 -0) 📝 `crates/horizon-client/src/game/wind.rs` (+48 -16) 📝 `crates/horizon-client/src/items.rs` (+7 -0) 📝 `crates/horizon-client/src/mobs.rs` (+27 -3) 📝 `crates/horizon-client/src/mobs/creaking.rs` (+1 -0) 📝 `crates/horizon-client/src/mobs/guardian.rs` (+4 -1) 📝 `crates/horizon-client/src/mobs/sulfur_cube.rs` (+1 -0) 📝 `crates/horizon-client/src/motion.rs` (+20 -0) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockUpdateOracle.java` (+2 -0) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDispenserOracle.java` (+157 -0) ➕ `tools/test_mace_parity.py` (+204 -0) </details> ### 📄 Description ## What was wrong A mace hit like any other weapon: no smash attack after a fall, no extra damage for the height fallen, no stopped fall (players took the full fall damage after a smash), no knockback around the target, no smash sounds or dust. Density, Breach and Wind Burst did nothing. ## What vanilla does (26.3) - `MaceItem.getAttackDamageBonus`: when `fallDistance > 1.5` and not gliding, 4 per block for the first 3 blocks, 2 for the next 5, 1 after that, plus `EnchantmentHelper.modifyFallBasedDamage` (Density's `smash_damage_per_fallen_block`) × fall distance, added before the critical hit. `getItemDamageSource` makes the hit `mace_smash` damage. - `MaceItem.hurtEnemy`: the attacker's Y velocity becomes `0.01F`, fall damage is waived from the impact point (`setIgnoreFallDamageFromCurrentImpulse`, 40-tick grace), `item.mace.smash_ground(_heavy)` (fall > 5) or `smash_air` at the player, `ServerPlayer.spawnExtraParticlesOnFall` (block particles on landing, 50 per block fallen), level event 2013 (dust pillars) under the target, and every living entity within 3.5 blocks of the target pushed by `(3.5 − d) × 0.7F × (2 if fall > 5) × (1 − knockback resistance)` and `0.7F` up. The player's allies (`isAlliedTo`: pets it tamed, allays that like it), spectators, marker armor stands and creative flyers are spared. `postHurtEnemy` resets the fall distance. - Breach: `CombatRules.getDamageAfterAbsorb` runs the weapon's `armor_effectiveness` effects over the armor fraction, clamped to [0, 1]. - Wind Burst: a `post_attack` `ExplodeEffect` on the attacker (radius 3.5, `trigger`, knockback 1.2 / 1.75 / 2.2), only when the attacker has fallen at least 1.5 blocks and isn't flying. - `ItemStack.hurtEnemy` / `postHurtEnemy`: weapons award the used statistic and wear by `weapon.item_damage_per_attack` (axes and pickaxes 2, swords and maces 1, no wear in creative, none for non-weapons). Smaller vanilla details matched along the way, all exercised by the harness: - `dealDefaultKnockback` is `0.4F`, not `0.4`, and reads the live knockback-resistance attribute. - `ServerExplosion.getSeenPercent` now uses the exact `COLLIDER` clip (`clip_world`), not a 0.1-step approximation over full cubes. This affected entities overlapping blocks. - Bursts post the `explode` game event first. `ServerPlayer.onExplosionHit` keeps the fall waived only for a wind charge's burst (any thrower, dispensers included); any other burst ends the impulse grace. - Visible armor stands feel bursts that affect block-like entities (Wind Burst; never a wind charge's). - Attack sounds play at the player. Mob hurt sounds play where the mob stands. `damage_dealt` and the damage-indicator hearts use the damage actually dealt. A hit that does nothing plays `attack.nodamage`. A critical hit needs `fallDistance > 0`. ## How it was tested `tools/test_mace_parity.py` (new) adds an `attack` case to `VanillaDispenserOracle`: a stand-in `ServerPlayer` hits a real target over the headless level. It runs `getAttackDamageBonus`, `hurtServer` (armor + Breach), `hurtEnemy`, `EnchantmentHelper.doPostAttackEffectsWithItemSource` (a real `ServerExplosion` for Wind Burst) and `postHurtEnemy`. Horizon's fixture runs the helpers `Game::attack` itself uses (`smash_damage_bonus`, `hurt_by_player`, `weapon_hit`). Cases vary the fall (including the 1.5 / 3 / 5 / 8 thresholds), gliding and flying, earlier impact points, Density / Breach / Wind Burst / Unbreaking mixes, swords, axes, pickaxes, sticks and empty hands, armored targets, knockback resistance, mobs and armor stands (markers too) around the target, and walls. Results: - **mace harness: 3000/3000** (1660 smashes, 589 Wind Bursts). It compares every target's health and velocity, the player's velocity, fall distance, impact point, grace time and landing-particle flag, sounds, level and game events, statistics, the held stack and the level random. - Dispenser harness: 6000/6000. - Use-item-on harness: 4000/4000. - `cargo test -p horizon-client`: all pass. - `cargo clippy --workspace --all-targets -D warnings`, `cargo fmt --check` and `tools/check_public_tree.py`: clean. In game (Linux build on a virtual screen, survival): dropping about 10 blocks onto an iron golem with a plain mace took it from 100 to 55.5 HP (6 base + the fall bonus, ×1.5 critical). The player took no fall damage. Two cows 2 blocks away were thrown about 6 blocks out and up, and the smash dust showed. With Wind Burst III, the same hit launched the player from y≈102 to y≈124. Not modelled, unchanged: the `player_hurt_entity` advancement trigger (Over-Overkill), knockback of LAN guests near the target, and scoreboard-team alliances for mobs. Fixes #105 🤖 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-02 15:55: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#2377
No description provided.