[PR #1203] [MERGED] Hoppers: skip the item scan when no item reaches the hopper's column #3416

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

📋 Pull Request Information

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

Base: main ← Head: claude/upstream-hoppers


📝 Commits (1)

  • 1867771 Hoppers: skip the item scan when no item reaches the hopper's column

📊 Changes

3 files changed (+170 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+3 -0)
📝 crates/horizon-client/src/game/block_entity_ticks.rs (+3 -0)
📝 crates/horizon-client/src/game/machines.rs (+164 -0)

📄 Description

Requested by JR

What and why

Fixes #1220.

Hoppers: skip the item scan when no item reaches the hopper's column

HopperBlockEntity.suckInItems scanned every item entity for each hopper
that ticked without a container above. During the block-entity pass the
game now keeps the set of block columns item boxes reach; a hopper whose
column is not in it has nothing to suck, and the scan (same order, same
item taken) runs only for the rest. Items do not move within the pass:
removals leave a superset, and additions (pushed at the end with a new
id) or removing the last item rebuild the set. It is dropped at the end
of the pass.

500 hoppers,  200 items:  1.36 -> 0.05 ms per tick
2000 hoppers, 500 items: 13.52 -> 0.26 ms per tick
2000 hoppers, 2000 items: 60.6 -> 3.3 ms per tick

Vanilla reference

HopperBlockEntity.suckInItems: the same items are found in the same order and the same item is taken; only hoppers no item box can reach skip the scan. Harness: test_block_entity_tickers_parity.py.

Self-check

pr_ready (tools/pr_ready.py --base upstream/main on Mac, against upstream/main at fd0473605, 1 min 44 s)

Check Result
Scope ✅ 3 files, +170 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (4 s)
clippy ✅ (22 s)
tests: horizon-client ✅ 1081 passed (1 min 13 s)
doc tests ✅ 0 passed (4 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)

🤖 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/1203 **Author:** [@pirut](https://github.com/pirut) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `claude/upstream-hoppers` --- ### 📝 Commits (1) - [`1867771`](https://github.com/horizon-rust/horizon/commit/186777110f6c7996889726d90d02a80f8f0cf9fa) Hoppers: skip the item scan when no item reaches the hopper's column ### 📊 Changes **3 files changed** (+170 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+3 -0) 📝 `crates/horizon-client/src/game/block_entity_ticks.rs` (+3 -0) 📝 `crates/horizon-client/src/game/machines.rs` (+164 -0) </details> ### 📄 Description <!-- claude-projects-attribution: {"github_login":"pirut"} --> _Requested by **JR**_ ## What and why Fixes #1220. Hoppers: skip the item scan when no item reaches the hopper's column HopperBlockEntity.suckInItems scanned every item entity for each hopper that ticked without a container above. During the block-entity pass the game now keeps the set of block columns item boxes reach; a hopper whose column is not in it has nothing to suck, and the scan (same order, same item taken) runs only for the rest. Items do not move within the pass: removals leave a superset, and additions (pushed at the end with a new id) or removing the last item rebuild the set. It is dropped at the end of the pass. ``` 500 hoppers, 200 items: 1.36 -> 0.05 ms per tick 2000 hoppers, 500 items: 13.52 -> 0.26 ms per tick 2000 hoppers, 2000 items: 60.6 -> 3.3 ms per tick ``` ## Vanilla reference `HopperBlockEntity.suckInItems`: the same items are found in the same order and the same item is taken; only hoppers no item box can reach skip the scan. Harness: `test_block_entity_tickers_parity.py`. ## Self-check **pr_ready** (`tools/pr_ready.py --base upstream/main` on Mac, against upstream/main at fd0473605, 1 min 44 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +170 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (4 s) | | clippy | ✅ (22 s) | | tests: horizon-client | ✅ 1081 passed (1 min 13 s) | | doc tests | ✅ 0 passed (4 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) | 🤖 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 04:09:22 +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#3416
No description provided.