[PR #1803] [MERGED] Keep scheduled ticks when a chunk unloads or post-processes before the next tick #3774

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

📋 Pull Request Information

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

Base: main ← Head: pr/keep-scheduled-ticks


📝 Commits (2)

  • f56785c Keep a chunk's scheduled ticks when it unloads before the next tick
  • e181b17 Register new chunks' ticks before post-processing them

📊 Changes

2 files changed (+8 additions, -4 deletions)

View changed files

📝 crates/horizon-client/src/game/persist.rs (+3 -4)
📝 crates/horizon-client/src/game/postprocess.rs (+5 -0)

📄 Description

What and why

Two small bugs lost scheduled block and fluid ticks. They are easy to hit with fast chunk loading, for example when you fly with a high render distance or pre-generate a world.

  1. A chunk unloaded before the next tick lost its ticks. attach_save_data took a chunk's ticks only from the tick scheduler. The scheduler picks up new chunks once per tick. So a chunk that loaded and unloaded between two ticks was saved with its block and fluid tick lists cleared, even though the chunk still had them. Now the chunk's own saved lists are kept when the scheduler doesn't know the chunk yet.

  2. Ticks scheduled during post-processing were dropped. postprocess_chunks ran before the chunks that arrived since the last tick were registered with the scheduler. Ticks scheduled by their post-processing marks (water, lava, leaves) went to chunks the scheduler didn't know, and were thrown away. Now the new chunks are registered first.

Vanilla reference

  • ChunkStatusTasks.full: LevelChunk.registerTickContainerInLevel runs when the chunk becomes full, before ChunkMap.prepareTickingChunk calls LevelChunk.postProcessGeneration. The second fix follows this order.
  • LevelChunk.getTicksForSerialization: vanilla saves the chunk's own tick containers, so ticks survive whether or not the level is ticking that chunk yet. The first fix keeps the same result.

I found both while comparing two pre-generated worlds chunk by chunk: the same seed gave different saved tick lists between runs.

Self-check

pr_ready (tools/pr_ready.py on device-591, against origin/main at 6a065fa48, 2 min 16 s)

Check Result
Scope ✅ 2 files, +8 −4
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (5 s)
clippy ✅ (40 s)
tests: horizon-client ✅ 1236 passed (1 min 29 s)
doc tests ✅ 0 passed (2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (no vanilla data here): 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/1803 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `pr/keep-scheduled-ticks` --- ### 📝 Commits (2) - [`f56785c`](https://github.com/horizon-rust/horizon/commit/f56785c2f512eef6eff83687455cbee97ecbcd11) Keep a chunk's scheduled ticks when it unloads before the next tick - [`e181b17`](https://github.com/horizon-rust/horizon/commit/e181b17e17a88f6c39fbb16dd4b81440d8e738e1) Register new chunks' ticks before post-processing them ### 📊 Changes **2 files changed** (+8 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/persist.rs` (+3 -4) 📝 `crates/horizon-client/src/game/postprocess.rs` (+5 -0) </details> ### 📄 Description ## What and why Two small bugs lost scheduled block and fluid ticks. They are easy to hit with fast chunk loading, for example when you fly with a high render distance or pre-generate a world. 1. **A chunk unloaded before the next tick lost its ticks.** `attach_save_data` took a chunk's ticks only from the tick scheduler. The scheduler picks up new chunks once per tick. So a chunk that loaded and unloaded between two ticks was saved with its block and fluid tick lists cleared, even though the chunk still had them. Now the chunk's own saved lists are kept when the scheduler doesn't know the chunk yet. 2. **Ticks scheduled during post-processing were dropped.** `postprocess_chunks` ran before the chunks that arrived since the last tick were registered with the scheduler. Ticks scheduled by their post-processing marks (water, lava, leaves) went to chunks the scheduler didn't know, and were thrown away. Now the new chunks are registered first. ## Vanilla reference - `ChunkStatusTasks.full`: `LevelChunk.registerTickContainerInLevel` runs when the chunk becomes full, before `ChunkMap.prepareTickingChunk` calls `LevelChunk.postProcessGeneration`. The second fix follows this order. - `LevelChunk.getTicksForSerialization`: vanilla saves the chunk's own tick containers, so ticks survive whether or not the level is ticking that chunk yet. The first fix keeps the same result. I found both while comparing two pre-generated worlds chunk by chunk: the same seed gave different saved tick lists between runs. ## Self-check **pr_ready** (`tools/pr_ready.py` on device-591, against origin/main at 6a065fa48, 2 min 16 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +8 −4 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (5 s) | | clippy | ✅ (40 s) | | tests: horizon-client | ✅ 1236 passed (1 min 29 s) | | doc tests | ✅ 0 passed (2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (no vanilla data here): 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 04:12:13 +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#3774
No description provided.