[PR #1943] [MERGED] Particles keep their sprites over a resource reload #3882

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1943
Author: @socksprox
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: fix/particle-atlas-reload


📝 Commits (1)

  • 2cdb636 Particles keep their sprites over a resource reload

📊 Changes

2 files changed (+42 additions, -10 deletions)

View changed files

📝 crates/horizon-client/src/game/packs.rs (+6 -0)
📝 crates/horizon-client/src/particles.rs (+36 -10)

📄 Description

🤖 Opened by an AI agent (Devin), not by the user themselves.

Summary

  • ParticleEngine copied the GUI atlas's sprite rects once at start. A resource-pack or server-pack change rebuilds the atlas but never refreshed the engine, so every named and set sprite then drew a stale region — block-break crumbs showed other blocks, campfire smoke showed random items. The engine now re-reads the rects and the packs' particles/*.json sprite sets on reload, and a live particle whose sprite-set index outlived the rebuild keeps its sprite instead of indexing past the new list.
  • The reload path now layers content mods over the root again (mods::content_root), matching startup — the first reload used to drop their assets and data.

Closes #1923

Test plan

  • Verified in a live game: enabled a resource pack mid-session, then /particle minecraft:block{block_state:"minecraft:dirt"} drew dirt-brown crumbs (before the fix: pink flecks sampled from a stale atlas region); disabling the pack keeps particles right
  • Break particles of dirt, grass (dirt crumbs), diamond, gold, oak leaves and fern all match vanilla while mining and on the destroy burst
  • python3 tools/pr_ready.py --quick below
  • Parity harnesses: CI (this branch's files list 283)
**pr_ready** (`tools/pr_ready.py --quick` on MacBookPro, against origin/main at fa2ae64d8, 3 min 32 s)

| Check | Result |
| --- | --- |
| Scope | ✅ 4 files, +109 −6 |
| Cargo.lock | ✅ unchanged |
| Public tree | ✅ |
| Python tests | ➖ no Python change |
| rustfmt | ❌ failed (5 s) |
| clippy | ✅ (33 s) |
| tests: horizon-client | ✅ 1246 passed (2 min 50 s) |
| doc tests | ✅ 0 passed (3 s) |
| tokens.css up to date | ➖ theme untouched |
| launcher rustfmt | ➖ launcher untouched |
| launcher clippy | ➖ launcher untouched |
| launcher tests | ➖ launcher untouched |
| Parity | ➖ 283 affected, to run in CI (--quick) |

rustfmt failed in that run only because it ran before cargo fmt; the committed tree is cargo fmt --check clean and clippy passes on it.

🤖 Generated with Devin


🔄 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/1943 **Author:** [@socksprox](https://github.com/socksprox) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/particle-atlas-reload` --- ### 📝 Commits (1) - [`2cdb636`](https://github.com/horizon-rust/horizon/commit/2cdb6362cae1e4d88894f4fda3a4dc3b49ada9bb) Particles keep their sprites over a resource reload ### 📊 Changes **2 files changed** (+42 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/packs.rs` (+6 -0) 📝 `crates/horizon-client/src/particles.rs` (+36 -10) </details> ### 📄 Description > 🤖 Opened by an AI agent (Devin), not by the user themselves. ## Summary - `ParticleEngine` copied the GUI atlas's sprite rects once at start. A resource-pack or server-pack change rebuilds the atlas but never refreshed the engine, so every named and set sprite then drew a stale region — block-break crumbs showed other blocks, campfire smoke showed random items. The engine now re-reads the rects and the packs' `particles/*.json` sprite sets on reload, and a live particle whose sprite-set index outlived the rebuild keeps its sprite instead of indexing past the new list. - The reload path now layers content mods over the root again (`mods::content_root`), matching startup — the first reload used to drop their assets and data. Closes #1923 #### Test plan - [x] Verified in a live game: enabled a resource pack mid-session, then `/particle minecraft:block{block_state:"minecraft:dirt"}` drew dirt-brown crumbs (before the fix: pink flecks sampled from a stale atlas region); disabling the pack keeps particles right - [x] Break particles of dirt, grass (dirt crumbs), diamond, gold, oak leaves and fern all match vanilla while mining and on the destroy burst - [x] `python3 tools/pr_ready.py --quick` below - [ ] Parity harnesses: CI (this branch's files list 283) ``` **pr_ready** (`tools/pr_ready.py --quick` on MacBookPro, against origin/main at fa2ae64d8, 3 min 32 s) | Check | Result | | --- | --- | | Scope | ✅ 4 files, +109 −6 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ❌ failed (5 s) | | clippy | ✅ (33 s) | | tests: horizon-client | ✅ 1246 passed (2 min 50 s) | | doc tests | ✅ 0 passed (3 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 283 affected, to run in CI (--quick) | ``` rustfmt failed in that run only because it ran before `cargo fmt`; the committed tree is `cargo fmt --check` clean and clippy passes on it. 🤖 Generated with Devin --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:12:59 +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#3882
No description provided.