[PR #5173] [MERGED] fix(mobs): a primed sulfur cube is still knocked about #6118

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5173
Author: @reservedbytes
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/primed-sulfur-cube-knockback


📝 Commits (1)

  • c488860 fix(mobs): a primed sulfur cube is still knocked about

📊 Changes

3 files changed (+27 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/mobs.rs (+8 -0)
📝 crates/horizon-client/src/mobs/ai.rs (+0 -1)
📝 crates/horizon-client/src/mobs/sulfur_cube.rs (+19 -0)

📄 Description

What and why

A sulfur cube carrying a block stops moving once it's primed
Hit it, shoot it or set off a rocket next to it and it stays where it is
Vanilla's SulfurCube.hurtServer lights the fuse and applies a block's immune knockback before it calls LivingEntity.hurtServer, so before the invulnerability check
Priming makes the cube permanently invulnerable, so in Horizon Mob::damage_with turned the hit away on invulnerable_flag before sulfur_cube::accepts_damage ever ran
The cube's hurtServer part now runs first in damage_with, before the invulnerable, dead and fire checks, as in vanilla
It's taken out of ai::accepts_damage so it doesn't run twice
An explosion's own push (ServerExplosion impulse) already reached a primed cube
Only the hurt knockback was missing
Left as is: Horizon still gives a block-carrying cube its own knockback for an explosion, where vanilla skips it for #no_knockback (SulfurCube.java:256)
A rocket's burst still deals explosion on main (fireworks.rs:472), and vanilla's fireworks does knock the cube back, so honouring #no_knockback here waits on rockets using fireworks (#4997)
Left as is: a spear stab also gives a block-carrying cube its own knockback, where vanilla's #no_knockback includes spear
A unit test primes a TNT cube, hits it and checks it's pushed away, keeps its health and keeps its fuse

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

SulfurCube.hurtServer (SulfurCube.java:244-265): priming at :245-253, the immune knockback at :255-261, then super.hurtServer at :264
SulfurCube.primeTime sets setPermanentlyInvulnerable(true) (SulfurCube.java:344)
LivingEntity.hurtServer returns on isInvulnerableTo first (LivingEntity.java:1193)

Other projects' code

none

Self-check

Check Result
Scope ✅ 3 files, +27 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 495 passed (1 min 4 s)
rustfmt ✅ (9 s)
clippy ✅ (2 min 28 s)
tests: horizon-client ✅ 1341 passed (6 min 15 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🔄 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/5173 **Author:** [@reservedbytes](https://github.com/reservedbytes) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/primed-sulfur-cube-knockback` --- ### 📝 Commits (1) - [`c488860`](https://github.com/horizon-rust/horizon/commit/c48886001b33490a1f92d0d163602e223c808a2f) fix(mobs): a primed sulfur cube is still knocked about ### 📊 Changes **3 files changed** (+27 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs.rs` (+8 -0) 📝 `crates/horizon-client/src/mobs/ai.rs` (+0 -1) 📝 `crates/horizon-client/src/mobs/sulfur_cube.rs` (+19 -0) </details> ### 📄 Description ## What and why A sulfur cube carrying a block stops moving once it's primed Hit it, shoot it or set off a rocket next to it and it stays where it is Vanilla's `SulfurCube.hurtServer` lights the fuse and applies a block's immune knockback before it calls `LivingEntity.hurtServer`, so before the invulnerability check Priming makes the cube permanently invulnerable, so in Horizon `Mob::damage_with` turned the hit away on `invulnerable_flag` before `sulfur_cube::accepts_damage` ever ran The cube's `hurtServer` part now runs first in `damage_with`, before the invulnerable, dead and fire checks, as in vanilla It's taken out of `ai::accepts_damage` so it doesn't run twice An explosion's own push (`ServerExplosion` impulse) already reached a primed cube Only the hurt knockback was missing Left as is: Horizon still gives a block-carrying cube its own knockback for an explosion, where vanilla skips it for `#no_knockback` (`SulfurCube.java:256`) A rocket's burst still deals `explosion` on `main` (`fireworks.rs:472`), and vanilla's `fireworks` does knock the cube back, so honouring `#no_knockback` here waits on rockets using `fireworks` (#4997) Left as is: a spear stab also gives a block-carrying cube its own knockback, where vanilla's `#no_knockback` includes `spear` A unit test primes a TNT cube, hits it and checks it's pushed away, keeps its health and keeps its fuse ## Kind - [x] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference `SulfurCube.hurtServer` (`SulfurCube.java:244-265`): priming at :245-253, the immune knockback at :255-261, then `super.hurtServer` at :264 `SulfurCube.primeTime` sets `setPermanentlyInvulnerable(true)` (`SulfurCube.java:344`) `LivingEntity.hurtServer` returns on `isInvulnerableTo` first (`LivingEntity.java:1193`) ## Other projects' code none ## Self-check | Check | Result | | --- | --- | | Scope | ✅ 3 files, +27 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 495 passed (1 min 4 s) | | rustfmt | ✅ (9 s) | | clippy | ✅ (2 min 28 s) | | tests: horizon-client | ✅ 1341 passed (6 min 15 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:12:14 +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#6118
No description provided.