[GH-ISSUE #6112] Sulfur cube holding a block: a sprint hit or a Knockback weapon adds no push (vanilla runs SulfurCube.knockback again for it) #1980

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

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

🤖 Filed by mariuslozo-boop's AI agent (Claude Code, Claude Sonnet 5.5 + Claude Opus 5.5 review), not by mariuslozo-boop personally.

A player hits a sulfur cube that holds a block. If the player is sprinting, or the weapon has Knockback, vanilla pushes the cube a second time, with SulfurCube.knockback, on top of the hit's own push. Horizon skips that second push, so a sprinting or Knockback hit launches the cube exactly as far as a plain hit. Other paths that push a cube after a hit (sweep, spear, goat ram) also do not reach the cube's own knockback.

What vanilla does

  • SulfurCube.hurtServer (SulfurCube.java:243-263): with a block, a hit from a source in #sulfur_cube_with_block_immune_to (a player's attack is) runs dealDefaultKnockback and returns true.
  • Player.attack (Player.java:973-979): hurtOrSimulate returned true, so causeExtraKnockback(entity, getKnockback + (sprint ? 0.5 : 0), ...) runs (Player.java:1111-1140). For a living target that is livingTarget.knockback(power, sin(yRot), -cos(yRot), damageSource, damage, true).
  • That lands in the cube's override SulfurCube.knockback (SulfurCube.java:829-877) because the source has a causing entity and the cube has a block. With comesFromEffect true the push is scaled by power * 0.25 on top of sqrt(damage).
  • The other callers also go through knockback and so through the override: Player.doSweepAttack (Player.java:1165-1172, after nearby.hurtServer returned true), LivingEntity.stabAttack (LivingEntity.java:2903-2904, a spear), Mob.doHurtTarget (Mob.java:1389).

What Horizon does

  • sulfur_cube::accepts_damage (crates/horizon-client/src/mobs/sulfur_cube.rs:524-566) makes the hit's own push through deal_default_knockback and then returns false (sulfur_cube.rs:565). Mob::damage_with (crates/horizon-client/src/mobs.rs:2643-2646) passes that false on.
  • attack_mob (crates/horizon-client/src/game.rs:11047) takes it as landed = false, so the whole if landed block is skipped, including the sprint/Knockback push (game.rs:11077-11081, self.mobs[index].knockback(...)).
  • That push, when it does run, is Mob::knockback (mobs.rs:2924), which never reaches sulfur_cube::knockback (sulfur_cube.rs:712). Only deal_default_knockback (sulfur_cube.rs:695-709) does.
  • The other paths, all Mob::knockback, so none reaches the override:
    • sweep neighbours: crates/horizon-client/src/game/mace.rs:569-573, inside if hurt_by_player(...), which is false for a cube with a block;
    • a spear stab: crates/horizon-client/src/game/spear.rs:227-233, no hurt guard, but Mob::knockback twice;
    • MobEvent::Knockback (a goat's ram, a mob's spear): crates/horizon-client/src/game/creatures.rs:1836.

How it was seen (183b53f0e, in WSL, tools/test_server_knockback_parity.py with temporary cases; vanilla 26.3 dedicated server against horizon-client --dedicated --nogui)

summon minecraft:sulfur_cube 2.5 -60 0.5 {PersistenceRequired:1b,equipment:{body:{id:"minecraft:tnt",count:1}}} slowed to a stop, game frozen, Alice (creative, wooden sword, two blocks west, facing it) hits it once; the cube's Motion is read right after the hit. Each case run on its own.

Hit Vanilla Motion Horizon Motion
plain 0.66 0.06616 0 0.33 -0.00752 0
sprinting (Alice sprint on) 0.7425 0.08416 0 0.33 -0.00752 0
Knockback II 0.825 0.10216 0 0.33 -0.00752 0

Horizon's three rows are identical. Vanilla's rows grow by 12.5% (sprint, power 0.5, 0.5 * 0.25) and 25% (Knockback II, power 1.0, 1.0 * 0.25) over the plain row, as the code above says.

The plain row differs between the two by a factor of 2; that is a separate cause, filed as #6113 (the cube's knockback resistance is -1 in vanilla and 0 in Horizon). It does not change this finding: the increase over the plain hit is 0 in Horizon.

What is not known

  • Only the player's sprint and Knockback hits were run. The sweep, spear and goat paths are by reading only: each calls Mob::knockback, which has no route to sulfur_cube::knockback.
  • By reading only: because landed is false, a hit on a cube with a block also skips everything after it in attack_mob: the weapon's wear and hurtEnemy, the post-attack effects, the damage stat, the food exhaustion, the sprint stop. In vanilla Player.attack runs all of those when hurtOrSimulate returned true (Player.java:975-989). Not run.
  • A cube without a block (the normal mob path) was not compared.

Likely fix

Make accepts_damage report the hit as landed (vanilla returns true) for the immune case, and route Mob::knockback's callers for a cube with a block through sulfur_cube::knockback with the source's causing entity and the damage.

Originally created by @mariuslozo-boop on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6112 > 🤖 Filed by mariuslozo-boop's AI agent (Claude Code, Claude Sonnet 5.5 + Claude Opus 5.5 review), not by mariuslozo-boop personally. A player hits a sulfur cube that holds a block. If the player is sprinting, or the weapon has Knockback, vanilla pushes the cube a second time, with `SulfurCube.knockback`, on top of the hit's own push. Horizon skips that second push, so a sprinting or Knockback hit launches the cube exactly as far as a plain hit. Other paths that push a cube after a hit (sweep, spear, goat ram) also do not reach the cube's own `knockback`. **What vanilla does** - `SulfurCube.hurtServer` (`SulfurCube.java:243-263`): with a block, a hit from a source in `#sulfur_cube_with_block_immune_to` (a player's attack is) runs `dealDefaultKnockback` and **returns true**. - `Player.attack` (`Player.java:973-979`): `hurtOrSimulate` returned true, so `causeExtraKnockback(entity, getKnockback + (sprint ? 0.5 : 0), ...)` runs (`Player.java:1111-1140`). For a living target that is `livingTarget.knockback(power, sin(yRot), -cos(yRot), damageSource, damage, true)`. - That lands in the cube's override `SulfurCube.knockback` (`SulfurCube.java:829-877`) because the source has a causing entity and the cube has a block. With `comesFromEffect` true the push is scaled by `power * 0.25` on top of `sqrt(damage)`. - The other callers also go through `knockback` and so through the override: `Player.doSweepAttack` (`Player.java:1165-1172`, after `nearby.hurtServer` returned true), `LivingEntity.stabAttack` (`LivingEntity.java:2903-2904`, a spear), `Mob.doHurtTarget` (`Mob.java:1389`). **What Horizon does** - `sulfur_cube::accepts_damage` (`crates/horizon-client/src/mobs/sulfur_cube.rs:524-566`) makes the hit's own push through `deal_default_knockback` and then **returns false** (`sulfur_cube.rs:565`). `Mob::damage_with` (`crates/horizon-client/src/mobs.rs:2643-2646`) passes that false on. - `attack_mob` (`crates/horizon-client/src/game.rs:11047`) takes it as `landed = false`, so the whole `if landed` block is skipped, including the sprint/Knockback push (`game.rs:11077-11081`, `self.mobs[index].knockback(...)`). - That push, when it does run, is `Mob::knockback` (`mobs.rs:2924`), which never reaches `sulfur_cube::knockback` (`sulfur_cube.rs:712`). Only `deal_default_knockback` (`sulfur_cube.rs:695-709`) does. - The other paths, all `Mob::knockback`, so none reaches the override: - sweep neighbours: `crates/horizon-client/src/game/mace.rs:569-573`, inside `if hurt_by_player(...)`, which is false for a cube with a block; - a spear stab: `crates/horizon-client/src/game/spear.rs:227-233`, no `hurt` guard, but `Mob::knockback` twice; - `MobEvent::Knockback` (a goat's ram, a mob's spear): `crates/horizon-client/src/game/creatures.rs:1836`. **How it was seen** (`183b53f0e`, in WSL, `tools/test_server_knockback_parity.py` with temporary cases; vanilla 26.3 dedicated server against `horizon-client --dedicated --nogui`) `summon minecraft:sulfur_cube 2.5 -60 0.5 {PersistenceRequired:1b,equipment:{body:{id:"minecraft:tnt",count:1}}}` slowed to a stop, game frozen, Alice (creative, wooden sword, two blocks west, facing it) hits it once; the cube's `Motion` is read right after the hit. Each case run on its own. | Hit | Vanilla `Motion` | Horizon `Motion` | | --- | --- | --- | | plain | `0.66 0.06616 0` | `0.33 -0.00752 0` | | sprinting (Alice sprint on) | `0.7425 0.08416 0` | `0.33 -0.00752 0` | | Knockback II | `0.825 0.10216 0` | `0.33 -0.00752 0` | Horizon's three rows are identical. Vanilla's rows grow by 12.5% (sprint, power 0.5, `0.5 * 0.25`) and 25% (Knockback II, power 1.0, `1.0 * 0.25`) over the plain row, as the code above says. The plain row differs between the two by a factor of 2; that is a separate cause, filed as #6113 (the cube's knockback resistance is -1 in vanilla and 0 in Horizon). It does not change this finding: the increase over the plain hit is 0 in Horizon. **What is not known** - Only the player's sprint and Knockback hits were run. The sweep, spear and goat paths are by reading only: each calls `Mob::knockback`, which has no route to `sulfur_cube::knockback`. - By reading only: because `landed` is false, a hit on a cube with a block also skips everything after it in `attack_mob`: the weapon's wear and `hurtEnemy`, the post-attack effects, the damage stat, the food exhaustion, the sprint stop. In vanilla `Player.attack` runs all of those when `hurtOrSimulate` returned true (`Player.java:975-989`). Not run. - A cube without a block (the normal mob path) was not compared. **Likely fix** Make `accepts_damage` report the hit as landed (vanilla returns true) for the immune case, and route `Mob::knockback`'s callers for a cube with a block through `sulfur_cube::knockback` with the source's causing entity and the damage.
Author
Owner

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

🤖 Agent: a fix is open in #6137; it closes this issue when merged.

<!-- gh-comment-id:6561432233 --> @xFedeT commented on GitHub (Nov 1, 2026): 🤖 Agent: a fix is open in #6137; it closes this issue when merged.
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#1980
No description provided.