[PR #5176] [MERGED] A creeper with effects leaves a lingering cloud when it explodes #6122

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

📋 Pull Request Information

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

Base: main ← Head: fix/creeper-lingering-cloud


📝 Commits (6)

  • 21b8d1f A creeper with effects leaves a lingering cloud when it explodes
  • bbd8709 Creeper cloud: the effects keep their visibility on those it affects
  • 39e0ed3 Merge remote-tracking branch 'origin/main' into fix/creeper-lingering-cloud
  • 6d6715f Merge remote-tracking branch 'origin/main' into fix/creeper-lingering-cloud
  • 7226036 Mob effects keep their ambient flag, and the creeper's cloud copies it
  • 97d4bbf Merge remote-tracking branch 'origin/main' into fix/creeper-lingering-cloud

📊 Changes

12 files changed (+255 additions, -20 deletions)

View changed files

📝 crates/horizon-client-core/src/potions.rs (+22 -2)
📝 crates/horizon-client/src/entity_nbt.rs (+9 -0)
📝 crates/horizon-client/src/game/client_ambient.rs (+1 -1)
📝 crates/horizon-client/src/game/commands/effects.rs (+5 -5)
📝 crates/horizon-client/src/game/creatures.rs (+9 -0)
📝 crates/horizon-client/src/game/lan.rs (+1 -1)
📝 crates/horizon-client/src/game/potions.rs (+72 -10)
📝 crates/horizon-client/src/mobs.rs (+87 -0)
📝 crates/horizon-client/src/mobs/ai.rs (+3 -0)
📝 crates/horizon-client/src/mobs/conversion.rs (+1 -0)
📝 crates/horizon-client/src/mobs/hostile.rs (+44 -0)
📝 tools/port_map/game2-002.tsv (+1 -1)

📄 Description

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

Refs #3513 (row Creeper.spawnLingeringCloud).

What and why

A creeper that has potion effects (a witch's splash, a dispenser's potion, /effect give) leaves them behind when it blows up: Creeper.explodeCreeper calls spawnLingeringCloud right after the blast. It makes an AreaEffectCloud of radius 2.5 where the creeper stood, with wait time 10, duration 300, radiusPerTick of -radius / duration, radiusOnUse of -0.5 and a potionDurationScale of 0.25, carrying a copy of every active effect. Horizon's creeper blew up and left nothing.

The change

  • mobs/hostile.rs: after the Explode event, a creeper with effects pushes MobEvent::LingeringCloud with them ((id, remaining ticks, amplifier)), the ones among them added hidden (hideParticles) or ambient, and the cloud's colour (PotionContents.getColorOptional: the visible effects' colours weighted by amplifier + 1; potions::effects_color).
  • game/potions.rs: the lingering-potion cloud, which already ticked as AreaEffectCloud.serverTick (wait, shrink, every 5 ticks affect each entity not affected in the last 20, radiusOnUse), takes its effects, its hidden ones and its radiusPerTick as data now instead of constants; spawn_creeper_cloud makes the creeper's. withScaledDuration is as vanilla: floor(duration * 0.25), at least 1, and an infinite effect stays infinite (it was made 1 tick before). The victims' effects keep the flags of the creeper's (new MobEffectInstance(effect) copies ambient and visible, and MobEffectInstance.update merges them on one already there: Mob::add_effect_with).
  • Port map: the row is port.

Vanilla reference

Creeper.explodeCreeper and spawnLingeringCloud (Creeper.java 232-258), AreaEffectCloud.serverTick (the loop above is the one already ported for lingering potions, compared again: wait time, radiusPerTick, radiusOnUse, the 5-tick victims pass, canBeAffected, instant effects at 0.5), MobEffectInstance.withScaledDuration, PotionContents.getColorOptional. Read before writing.

Proof, from the real game

A creeper summoned with active_effects:[{id:"minecraft:poison",duration:2400}] (swirls around it) walks up to the player, swells, blows up, and a poison cloud stays over the crater for the frames that follow (horizon-ctl, real game, offscreen):

creeper cloud

On main nothing is left there. Unit test effects_mix_their_colours_by_amplifier pins the colour mix against the vanilla formula.

pr_ready --quick: fmt, clippy, 1390 tests pass; parity harnesses left to CI.

Ambient effects of a mob

The cloud copies each effect's flags, so a mob has to keep them. It kept hidden_effects only and its NBT loader dropped ambient ("a mob's effects are never ambient"); vanilla keeps it (MobEffectInstance.CODEC, ambient written when true). Mob::extra.ambient_effects is now loaded and saved, kept through conversion and expiry, set by /effect give as new MobEffectInstance(effect, duration, amplifier, false, particles) through add_effect_with, and decides DATA_EFFECT_AMBIENCE_ID and the faint swirls (areAllEffectsAmbient over the visible effects). Test an_effect_added_again_updates_its_ambient_and_visible_flags_as_vanilla pins update's flag rules.

🤖 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/5176 **Author:** [@xFedeT](https://github.com/xFedeT) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/creeper-lingering-cloud` --- ### 📝 Commits (6) - [`21b8d1f`](https://github.com/horizon-rust/horizon/commit/21b8d1f527f4456e6f46403850bdf8cfc4610cb5) A creeper with effects leaves a lingering cloud when it explodes - [`bbd8709`](https://github.com/horizon-rust/horizon/commit/bbd87091bfe768d2233c9b3d163c876ec98985f0) Creeper cloud: the effects keep their visibility on those it affects - [`39e0ed3`](https://github.com/horizon-rust/horizon/commit/39e0ed339e9ab2b6c751fe4a8c15fb156a886b75) Merge remote-tracking branch 'origin/main' into fix/creeper-lingering-cloud - [`6d6715f`](https://github.com/horizon-rust/horizon/commit/6d6715fd11514d7944375e8c7364ae8987ad7b33) Merge remote-tracking branch 'origin/main' into fix/creeper-lingering-cloud - [`7226036`](https://github.com/horizon-rust/horizon/commit/722603631b6918664fb4c95331aecadfaa5cc70c) Mob effects keep their ambient flag, and the creeper's cloud copies it - [`97d4bbf`](https://github.com/horizon-rust/horizon/commit/97d4bbf06cd9bc8f5377ad84b75c8f250f60c2fb) Merge remote-tracking branch 'origin/main' into fix/creeper-lingering-cloud ### 📊 Changes **12 files changed** (+255 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-core/src/potions.rs` (+22 -2) 📝 `crates/horizon-client/src/entity_nbt.rs` (+9 -0) 📝 `crates/horizon-client/src/game/client_ambient.rs` (+1 -1) 📝 `crates/horizon-client/src/game/commands/effects.rs` (+5 -5) 📝 `crates/horizon-client/src/game/creatures.rs` (+9 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+1 -1) 📝 `crates/horizon-client/src/game/potions.rs` (+72 -10) 📝 `crates/horizon-client/src/mobs.rs` (+87 -0) 📝 `crates/horizon-client/src/mobs/ai.rs` (+3 -0) 📝 `crates/horizon-client/src/mobs/conversion.rs` (+1 -0) 📝 `crates/horizon-client/src/mobs/hostile.rs` (+44 -0) 📝 `tools/port_map/game2-002.tsv` (+1 -1) </details> ### 📄 Description > 🤖 Opened by xFedeT's AI agent (Claude Code, Claude Sonnet 5.5), not by xFedeT personally. Refs #3513 (row `Creeper.spawnLingeringCloud`). ## What and why A creeper that has potion effects (a witch's splash, a dispenser's potion, `/effect give`) leaves them behind when it blows up: `Creeper.explodeCreeper` calls `spawnLingeringCloud` right after the blast. It makes an `AreaEffectCloud` of radius 2.5 where the creeper stood, with wait time 10, duration 300, `radiusPerTick` of `-radius / duration`, `radiusOnUse` of -0.5 and a `potionDurationScale` of 0.25, carrying a copy of every active effect. Horizon's creeper blew up and left nothing. ## The change - `mobs/hostile.rs`: after the `Explode` event, a creeper with effects pushes `MobEvent::LingeringCloud` with them (`(id, remaining ticks, amplifier)`), the ones among them added hidden (`hideParticles`) or ambient, and the cloud's colour (`PotionContents.getColorOptional`: the visible effects' colours weighted by amplifier + 1; `potions::effects_color`). - `game/potions.rs`: the lingering-potion cloud, which already ticked as `AreaEffectCloud.serverTick` (wait, shrink, every 5 ticks affect each entity not affected in the last 20, `radiusOnUse`), takes its effects, its hidden ones and its `radiusPerTick` as data now instead of constants; `spawn_creeper_cloud` makes the creeper's. `withScaledDuration` is as vanilla: `floor(duration * 0.25)`, at least 1, and an infinite effect stays infinite (it was made 1 tick before). The victims' effects keep the flags of the creeper's (`new MobEffectInstance(effect)` copies `ambient` and `visible`, and `MobEffectInstance.update` merges them on one already there: `Mob::add_effect_with`). - Port map: the row is `port`. ## Vanilla reference `Creeper.explodeCreeper` and `spawnLingeringCloud` (`Creeper.java` 232-258), `AreaEffectCloud.serverTick` (the loop above is the one already ported for lingering potions, compared again: wait time, `radiusPerTick`, `radiusOnUse`, the 5-tick victims pass, `canBeAffected`, instant effects at 0.5), `MobEffectInstance.withScaledDuration`, `PotionContents.getColorOptional`. Read before writing. ## Proof, from the real game A creeper summoned with `active_effects:[{id:"minecraft:poison",duration:2400}]` (swirls around it) walks up to the player, swells, blows up, and a poison cloud stays over the crater for the frames that follow (`horizon-ctl`, real game, offscreen): ![creeper cloud](https://raw.githubusercontent.com/xFedeT/horizon/pr-screenshots/3513/creeper-cloud.gif) On `main` nothing is left there. Unit test `effects_mix_their_colours_by_amplifier` pins the colour mix against the vanilla formula. `pr_ready --quick`: fmt, clippy, 1390 tests pass; parity harnesses left to CI. ## Ambient effects of a mob The cloud copies each effect's flags, so a mob has to keep them. It kept `hidden_effects` only and its NBT loader dropped `ambient` ("a mob's effects are never ambient"); vanilla keeps it (`MobEffectInstance.CODEC`, `ambient` written when true). `Mob::extra.ambient_effects` is now loaded and saved, kept through conversion and expiry, set by `/effect give` as `new MobEffectInstance(effect, duration, amplifier, false, particles)` through `add_effect_with`, and decides `DATA_EFFECT_AMBIENCE_ID` and the faint swirls (`areAllEffectsAmbient` over the visible effects). Test `an_effect_added_again_updates_its_ambient_and_visible_flags_as_vanilla` pins `update`'s flag rules. 🤖 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:12:21 +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#6122
No description provided.