[PR #104] [MERGED] Particle emitters: waxing, scraping, sparks, eating, snowballs, eggs, slimes (part of #63, stacked on #96) #2328

Closed
opened 2026-11-02 15:55:00 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/104
Author: @ludovic111
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @ludovic111

Base: main ← Head: fix/particles-63-item-emitters


📝 Commits (1)

  • 70583cb Particle emitters: waxing, scraping, sparks, eating, snowballs, eggs, slimes

📊 Changes

11 files changed (+476 additions, -51 deletions)

View changed files

➕ crates/horizon-client/examples/emitter_particles_probe.rs (+74 -0)
📝 crates/horizon-client/src/game.rs (+30 -34)
📝 crates/horizon-client/src/game/copper_golems.rs (+7 -0)
📝 crates/horizon-client/src/game/creatures.rs (+19 -15)
📝 crates/horizon-client/src/game/item_particles.rs (+23 -1)
➕ crates/horizon-client/src/game/level_particles.rs (+44 -0)
📝 crates/horizon-client/src/game/lightning.rs (+7 -0)
📝 crates/horizon-client/src/mobs/cube.rs (+29 -1)
📝 crates/horizon-client/src/particles.rs (+108 -0)
➕ mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEmitterParticlesOracle.java (+82 -0)
➕ tools/test_emitter_particles_parity.py (+53 -0)

📄 Description

Stacked on #96, which adds the particle types this PR spawns. This PR targets #96's branch, so the diff below is only this PR's commit; merge #96 first.

What was wrong

Several of vanilla's particle emitters were missing from Horizon or spawned the wrong thing:

emitter vanilla was
waxing, wax removal, scraping copper level events 3003/3004/3005 → ParticleUtils.spawnParticlesOnBlockFaces(…, UniformInt.of(3, 5)): 3–5 wax_on/wax_off/scrape particles on every face, moving along it. Sent by HoneycombItem.useOn, BlockTransformer.TransformParticle.send (axes), dispensed honeycomb and CopperGolem no particles; the dispenser's 3003 event was ignored
struck lightning rod level event 3002 with the rod's axis → spawnParticlesAlongAxis(…, 0.125, ELECTRIC_SPARK, UniformInt.of(10, 19)) no sparks
eating LivingEntity.spawnItemParticles: crumbs in front of the eyes, thrown along the look; ITEM particles in full colour; 5 per shouldEmitParticlesAndSounds tick and 16 on Consumable.onConsume grey terrain crumbs 0.1 below the eyes; no burst on consume; emitted a tick late plus once more at the end
snowball / egg breaking Snowball/ThrownEgg.handleEntityEvent(3): 8 ItemParticleOptions of the thrown item, at rest for a snowball and moving up to ±0.04 per axis for an egg grey terrain crumbs with invented motion, drawn from the world random
slime, magma cube and sulfur cube landing AbstractCubeMob.tick: size × 16 item_slime/flame/sulfur_cube_goo around the body. The mob's random draws for them on the server too no particles, and the mob's random missed those draws, so the cube's later random behaviour drifted from vanilla

The fix

  • particles::on_block_faces, particles::along_axis and particles::item_use_particles mirror the vanilla emitters.
  • game/level_particles.rs handles level events 3002–3005, drawing from the client level random (ParticleEngine::level_random). The honeycomb, axe transformer, copper golem and lightning rod paths now send those events.
  • Eating uses item_use_particles with the stack's ItemParticleOption, and the vanilla emission timing.
  • Snowball and egg breaks spawn item particles.
  • mobs/cube.rs draws the landing splash from the mob's random, as AbstractCubeMob.tick does on both sides.

How it's tested

New harness: tools/test_emitter_particles_parity.py, with VanillaEmitterParticlesOracle.java and examples/emitter_particles_probe.rs.

  • It runs the real ParticleUtils.spawnParticlesOnBlockFaces and spawnParticlesAlongAxis (all three axes) on a stand-in level with a seeded random.
  • It runs the real LivingEntity.spawnItemParticles on an entity given a position, rotation, eye height and seeded random.
  • It compares particle, count, position, motion and the random's next value.
python3 tools/test_emitter_particles_parity.py
1,500 rust-emitter-particles-parity cases match the pinned client (19,153 output lines)

particle_providers still passes. cargo clippy --workspace --all-targets --locked -- -D warnings and cargo test --workspace --locked pass (Mac mini), and tools/check_public_tree.py passes.

The snowball and egg bursts and the cube landing splash have no harness: entity data and a full entity tick were too much to stand in. Each is a few lines that follow the vanilla source quoted in its comment.

Still not done for #63

  • Sweep attacks: Horizon has no sweeping attack yet, so nothing spawns sweep_attack.
  • Squid and glow squid ink (Squid.spawnInk on hurt) and the glow squid's glow: the squid has no squirt yet.
  • Trial spawner and vault detection (trial_spawner_detection, level events 3013 and others), ominous_spawning, trial_omen/raid_omen from the bad omen effect, firefly (FireflyBushBlock.animateTick), fishing (FishingHook), spit (llama spit), dust_plume (BrushableBlock and others), pause_mob_growth/reset_mob_growth (golden dandelion), block_marker (barrier and light in hand), potion splash item particles (level event 2002), drinking.
  • Emitters not yet audited against vanilla: the other MobEvent::Particles bursts (warden, undead, wither, ravager, illusioner, nether mobs, wolf shaking) and the block animateTick particles.

Part of #63

🤖 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/104 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/particles-63-item-emitters` --- ### 📝 Commits (1) - [`70583cb`](https://github.com/horizon-rust/horizon/commit/70583cbf2a92c9cb9f4af16567d9657c1b4ed060) Particle emitters: waxing, scraping, sparks, eating, snowballs, eggs, slimes ### 📊 Changes **11 files changed** (+476 additions, -51 deletions) <details> <summary>View changed files</summary> ➕ `crates/horizon-client/examples/emitter_particles_probe.rs` (+74 -0) 📝 `crates/horizon-client/src/game.rs` (+30 -34) 📝 `crates/horizon-client/src/game/copper_golems.rs` (+7 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+19 -15) 📝 `crates/horizon-client/src/game/item_particles.rs` (+23 -1) ➕ `crates/horizon-client/src/game/level_particles.rs` (+44 -0) 📝 `crates/horizon-client/src/game/lightning.rs` (+7 -0) 📝 `crates/horizon-client/src/mobs/cube.rs` (+29 -1) 📝 `crates/horizon-client/src/particles.rs` (+108 -0) ➕ `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEmitterParticlesOracle.java` (+82 -0) ➕ `tools/test_emitter_particles_parity.py` (+53 -0) </details> ### 📄 Description **Stacked on #96**, which adds the particle types this PR spawns. This PR targets #96's branch, so the diff below is only this PR's commit; merge #96 first. ## What was wrong Several of vanilla's particle emitters were missing from Horizon or spawned the wrong thing: | emitter | vanilla | was | |---|---|---| | waxing, wax removal, scraping copper | level events 3003/3004/3005 → `ParticleUtils.spawnParticlesOnBlockFaces(…, UniformInt.of(3, 5))`: 3–5 `wax_on`/`wax_off`/`scrape` particles on every face, moving along it. Sent by `HoneycombItem.useOn`, `BlockTransformer.TransformParticle.send` (axes), dispensed honeycomb and `CopperGolem` | no particles; the dispenser's 3003 event was ignored | | struck lightning rod | level event 3002 with the rod's axis → `spawnParticlesAlongAxis(…, 0.125, ELECTRIC_SPARK, UniformInt.of(10, 19))` | no sparks | | eating | `LivingEntity.spawnItemParticles`: crumbs in front of the eyes, thrown along the look; `ITEM` particles in full colour; 5 per `shouldEmitParticlesAndSounds` tick and 16 on `Consumable.onConsume` | grey terrain crumbs 0.1 below the eyes; no burst on consume; emitted a tick late plus once more at the end | | snowball / egg breaking | `Snowball`/`ThrownEgg.handleEntityEvent(3)`: 8 `ItemParticleOption`s of the thrown item, at rest for a snowball and moving up to ±0.04 per axis for an egg | grey terrain crumbs with invented motion, drawn from the world random | | slime, magma cube and sulfur cube landing | `AbstractCubeMob.tick`: size × 16 `item_slime`/`flame`/`sulfur_cube_goo` around the body. The mob's random draws for them on the server too | no particles, and the mob's random missed those draws, so the cube's later random behaviour drifted from vanilla | ## The fix - `particles::on_block_faces`, `particles::along_axis` and `particles::item_use_particles` mirror the vanilla emitters. - `game/level_particles.rs` handles level events 3002–3005, drawing from the client level random (`ParticleEngine::level_random`). The honeycomb, axe transformer, copper golem and lightning rod paths now send those events. - Eating uses `item_use_particles` with the stack's `ItemParticleOption`, and the vanilla emission timing. - Snowball and egg breaks spawn item particles. - `mobs/cube.rs` draws the landing splash from the mob's random, as `AbstractCubeMob.tick` does on both sides. ## How it's tested New harness: `tools/test_emitter_particles_parity.py`, with `VanillaEmitterParticlesOracle.java` and `examples/emitter_particles_probe.rs`. - It runs the real `ParticleUtils.spawnParticlesOnBlockFaces` and `spawnParticlesAlongAxis` (all three axes) on a stand-in level with a seeded random. - It runs the real `LivingEntity.spawnItemParticles` on an entity given a position, rotation, eye height and seeded random. - It compares particle, count, position, motion and the random's next value. ``` python3 tools/test_emitter_particles_parity.py 1,500 rust-emitter-particles-parity cases match the pinned client (19,153 output lines) ``` `particle_providers` still passes. `cargo clippy --workspace --all-targets --locked -- -D warnings` and `cargo test --workspace --locked` pass (Mac mini), and `tools/check_public_tree.py` passes. The snowball and egg bursts and the cube landing splash have no harness: entity data and a full entity tick were too much to stand in. Each is a few lines that follow the vanilla source quoted in its comment. ## Still not done for #63 - Sweep attacks: Horizon has no sweeping attack yet, so nothing spawns `sweep_attack`. - Squid and glow squid ink (`Squid.spawnInk` on hurt) and the glow squid's `glow`: the squid has no squirt yet. - Trial spawner and vault detection (`trial_spawner_detection`, level events 3013 and others), `ominous_spawning`, `trial_omen`/`raid_omen` from the bad omen effect, `firefly` (`FireflyBushBlock.animateTick`), `fishing` (`FishingHook`), `spit` (llama spit), `dust_plume` (`BrushableBlock` and others), `pause_mob_growth`/`reset_mob_growth` (golden dandelion), `block_marker` (barrier and light in hand), potion splash item particles (level event 2002), drinking. - Emitters not yet audited against vanilla: the other `MobEvent::Particles` bursts (warden, undead, wither, ravager, illusioner, nether mobs, wolf shaking) and the block `animateTick` particles. Part of #63 🤖 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-02 15:55:00 +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#2328
No description provided.