[PR #6146] [MERGED] Sulfur cube: keep negative knockback resistance like vanilla #6677

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6146
Author: @Joansitoh
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/6113-sulfur-knockback-resistance


📝 Commits (2)

  • 2bdc10a Sulfur cube: keep negative knockback resistance (-2..1) like vanilla
  • d73a407 Sulfur cube: compute the player push factor in double, with a tested helper

📊 Changes

1 file changed (+47 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/mobs/sulfur_cube.rs (+47 -3)

📄 Description

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

Part of #6113

What: A sulfur cube holding a block had its knockback_resistance clamped to 0..1, so archetypes with a negative value (explosive, fast_flat, hot, light, regular = -1; bouncy, sticky = -2) took less knockback than vanilla. Both clamps now use vanilla's -2..1 range:

  • knockback() -> launch gets resistance(attr).
  • player_push uses push_factor(attr) = max(0, 1 - clamp(attr, -2, 1)), in double.

Vanilla: SulfurCube.knockback (horizontalPower *= (float)(1 - resistance), same for vertical, no clamp); SulfurCube.playerPush (Math.max(0, 1 - attr)); Attributes.KNOCKBACK_RESISTANCE is a RangedAttribute -2..1.

Not in this PR: /attribute ... knockback_resistance get still shows 0.0 for these cubes (finalize.rs / lan_attributes.rs), a separate fix.

Tested: new resistance_tests in sulfur_cube.rs (explosive r=-1 gives 2x the r=0 knock, bouncy r=-2 gives 3x, push factors 2/3/0). They fail with the old 0..1 clamp. server_knockback harness passes. A separate Sonnet 5.5 review answered SIN DEFECTO.

pr_ready --quick (before the last small commit; clippy re-run clean after it): fmt, clippy, public tree and Python tests pass. horizon-client: 1192 passed, 1 failed, entities::armor_stand_motion_tests::a_tick_keeps_the_previous_position_for_interpolation, an armor stand test in entities.rs that this diff doesn't touch.

Remaining affected harnesses: run by CI's parity job.

Suggested label: none (fix)

🤖 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/6146 **Author:** [@Joansitoh](https://github.com/Joansitoh) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/6113-sulfur-knockback-resistance` --- ### 📝 Commits (2) - [`2bdc10a`](https://github.com/horizon-rust/horizon/commit/2bdc10aa27661d4e88356e769425f700a6ec23d7) Sulfur cube: keep negative knockback resistance (-2..1) like vanilla - [`d73a407`](https://github.com/horizon-rust/horizon/commit/d73a40748d33eecdd6575d74308fb86ae5d98564) Sulfur cube: compute the player push factor in double, with a tested helper ### 📊 Changes **1 file changed** (+47 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/sulfur_cube.rs` (+47 -3) </details> ### 📄 Description > 🤖 Opened by Joansitoh's AI agent (Claude Code, Sonnet 5.5), not by Joansitoh personally. Part of #6113 **What:** A sulfur cube holding a block had its `knockback_resistance` clamped to 0..1, so archetypes with a negative value (explosive, fast_flat, hot, light, regular = -1; bouncy, sticky = -2) took less knockback than vanilla. Both clamps now use vanilla's -2..1 range: - `knockback()` -> `launch` gets `resistance(attr)`. - `player_push` uses `push_factor(attr)` = `max(0, 1 - clamp(attr, -2, 1))`, in double. **Vanilla:** `SulfurCube.knockback` (`horizontalPower *= (float)(1 - resistance)`, same for vertical, no clamp); `SulfurCube.playerPush` (`Math.max(0, 1 - attr)`); `Attributes.KNOCKBACK_RESISTANCE` is a RangedAttribute -2..1. **Not in this PR:** `/attribute ... knockback_resistance get` still shows 0.0 for these cubes (finalize.rs / lan_attributes.rs), a separate fix. **Tested:** new `resistance_tests` in `sulfur_cube.rs` (explosive r=-1 gives 2x the r=0 knock, bouncy r=-2 gives 3x, push factors 2/3/0). They fail with the old 0..1 clamp. `server_knockback` harness passes. A separate Sonnet 5.5 review answered SIN DEFECTO. `pr_ready --quick` (before the last small commit; clippy re-run clean after it): fmt, clippy, public tree and Python tests pass. horizon-client: 1192 passed, 1 failed, `entities::armor_stand_motion_tests::a_tick_keeps_the_previous_position_for_interpolation`, an armor stand test in entities.rs that this diff doesn't touch. Remaining affected harnesses: run by CI's parity job. Suggested label: none (fix) 🤖 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:24:49 +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#6677
No description provided.