[PR #7533] [MERGED] A charging wither sheds its potion-coloured particles again #7652

Closed
opened 2026-11-03 07:21:28 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7533
Author: @MSedgeMC
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: fix/wither-spawn-particles


📝 Commits (3)

  • 8064fd3 fix: a charging wither sheds its potion-coloured particles again
  • d4497e9 test: pin the charging wither's three potion-coloured particles
  • 1a8c48a Wither: the charge's cloud on a server's clients too

📊 Changes

2 files changed (+88 additions, -6 deletions)

View changed files

📝 crates/horizon-client/src/game/remote.rs (+6 -1)
📝 crates/horizon-client/src/mobs/wither.rs (+82 -5)

📄 Description

Vanilla

WitherBoss.aiStep's tail, in the order the bytecode runs it:

  • for each of the three heads, this.random.nextGaussian() three times and one
    SMOKE particle at getHeadX/Y/Z(i) offset by those gaussians times
    0.3f * getScale();

  • if isPowered(), one chance in four from the level's random
    (level.getRandom().nextInt(4)) of an ENTITY_EFFECT particle coloured
    ColorParticleOption.create(ENTITY_EFFECT, 0.7f, 0.7f, 0.5f) at the same
    offsets;

  • if (this.getInvulnerableTicks() > 0), the spawn charge: three
    ENTITY_EFFECT particles coloured (0.7f, 0.7f, 0.9f) a tick, each at

    getX() + random.nextGaussian(),
    getY() + random.nextFloat() * (3.3f * getScale()),
    getZ() + random.nextGaussian()
    

    — the wither's own random, in the order gaussian, float, gaussian.

That last block is the potion-like cloud the report is about: it lasts the 220
ticks of INVULNERABLE while the wither rises and shrinks into place.

What Horizon got wrong

mobs/wither.rs's ai_step had the block, with the comment
"the entity-effect particles roll the level random, not the wither's", and its
whole body was three bare random calls:

if m.extra.counter > 0 {
    for _ in 0..3 {
        m.random.next_gaussian();
        m.random.next_float();
        m.random.next_gaussian();
    }
}

The rolls were kept (so the wither's random stream stayed in step with
vanilla) and the particles they compute were thrown away, so a spawning wither
showed only the head smoke.

The block now builds the three MobEvent::ParticleColored particles from
those rolls, in vanilla's order and colour, with the y offset scaled by
getScale() (riders::scale, 1.0 for a plain wither). The comment's premise
was wrong for this block — vanilla reads this.random here; only the powered
retaliation particle uses the level random, and that one stays out of this
change (see below).

Proven: the new unit test fails on the old code with
assertion left == right failed: three a tick, as many as the heads' smoke: left: 0, right: 3. With the change it gets three ParticleColored events
whose colour is [0.7, 0.7, 0.9] and whose positions match the wither's own
random advanced as nextGaussian, nextFloat * 3.3 * scale, nextGaussian:
at scale 1 the y offsets fall in [64.0, 67.3) and at scale 2 in
[64.0, 70.6); at counter == 0 it reports none.

Not proven: not watched in a running game here (no prepared assets), so
what a frame looks like is untested — the event list is. Also out of scope,
and still missing: the isPowered() retaliation particle needs the level
random, which MobWorld does not carry; and a wither on a dedicated server
takes the client_smoke path (WitherBoss.aiStep on a client of a server),
which does not draw this cloud either.

Fixes #7486


🔄 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/7533 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/wither-spawn-particles` --- ### 📝 Commits (3) - [`8064fd3`](https://github.com/horizon-rust/horizon/commit/8064fd32f26d6554481d041fd5a87f5f6ce6b68c) fix: a charging wither sheds its potion-coloured particles again - [`d4497e9`](https://github.com/horizon-rust/horizon/commit/d4497e91f9ba642ef1d7551c840e05f88aac05ac) test: pin the charging wither's three potion-coloured particles - [`1a8c48a`](https://github.com/horizon-rust/horizon/commit/1a8c48a62f912d342cf3cd7876918d4883037e67) Wither: the charge's cloud on a server's clients too ### 📊 Changes **2 files changed** (+88 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/remote.rs` (+6 -1) 📝 `crates/horizon-client/src/mobs/wither.rs` (+82 -5) </details> ### 📄 Description ## Vanilla `WitherBoss.aiStep`'s tail, in the order the bytecode runs it: - for each of the three heads, `this.random.nextGaussian()` three times and one `SMOKE` particle at `getHeadX/Y/Z(i)` offset by those gaussians times `0.3f * getScale()`; - if `isPowered()`, one chance in four from **the level's** random (`level.getRandom().nextInt(4)`) of an `ENTITY_EFFECT` particle coloured `ColorParticleOption.create(ENTITY_EFFECT, 0.7f, 0.7f, 0.5f)` at the same offsets; - `if (this.getInvulnerableTicks() > 0)`, the spawn charge: three `ENTITY_EFFECT` particles coloured `(0.7f, 0.7f, 0.9f)` a tick, each at ``` getX() + random.nextGaussian(), getY() + random.nextFloat() * (3.3f * getScale()), getZ() + random.nextGaussian() ``` — the wither's own `random`, in the order gaussian, float, gaussian. That last block is the potion-like cloud the report is about: it lasts the 220 ticks of `INVULNERABLE` while the wither rises and shrinks into place. ## What Horizon got wrong `mobs/wither.rs`'s `ai_step` had the block, with the comment "the entity-effect particles roll the level random, not the wither's", and its whole body was three bare random calls: ```rust if m.extra.counter > 0 { for _ in 0..3 { m.random.next_gaussian(); m.random.next_float(); m.random.next_gaussian(); } } ``` The rolls were kept (so the wither's random stream stayed in step with vanilla) and the particles they compute were thrown away, so a spawning wither showed only the head smoke. The block now builds the three `MobEvent::ParticleColored` particles from those rolls, in vanilla's order and colour, with the y offset scaled by `getScale()` (`riders::scale`, 1.0 for a plain wither). The comment's premise was wrong for this block — vanilla reads `this.random` here; only the powered retaliation particle uses the level random, and that one stays out of this change (see below). **Proven:** the new unit test fails on the old code with `assertion left == right failed: three a tick, as many as the heads' smoke: left: 0, right: 3`. With the change it gets three `ParticleColored` events whose colour is `[0.7, 0.7, 0.9]` and whose positions match the wither's own random advanced as `nextGaussian, nextFloat * 3.3 * scale, nextGaussian`: at scale 1 the y offsets fall in `[64.0, 67.3)` and at scale 2 in `[64.0, 70.6)`; at `counter == 0` it reports none. **Not proven:** not watched in a running game here (no prepared assets), so what a frame looks like is untested — the event list is. Also out of scope, and still missing: the `isPowered()` retaliation particle needs the *level* random, which `MobWorld` does not carry; and a wither on a dedicated server takes the `client_smoke` path (`WitherBoss.aiStep` on a client of a server), which does not draw this cloud either. Fixes #7486 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 07:21: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#7652
No description provided.