From 47a00d283dde557496639ac438a3372be042d746 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sat, 17 Oct 2026 11:07:58 +0200 Subject: [PATCH] Hoppers: look up the block only under container block entities tick_hoppers read the block under every block entity in the loaded world each tick to find the hoppers. A hopper's block entity is always a plain container (BlockEntity::Chest), so only those need the lookup. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game/machines.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/horizon-client/src/game/machines.rs b/crates/horizon-client/src/game/machines.rs index 0d334d248..6947041f2 100644 --- a/crates/horizon-client/src/game/machines.rs +++ b/crates/horizon-client/src/game/machines.rs @@ -506,11 +506,15 @@ impl Game<'_> { .default_state("minecraft:hopper") .map(|s| self.res.facts.get(s).name.clone()); let Some(hopper) = hopper else { return Ok(()) }; + // A hopper's block entity is a plain container (`Chest`): only those + // need their block looked up (the ticker runs for a HopperBlockEntity + // whose block is still a hopper, `BlockEntityType.isValid`). let mut positions: Vec = self .world .block_entities - .keys() - .copied() + .iter() + .filter(|(_, e)| matches!(e, BlockEntity::Chest(_))) + .map(|(p, _)| *p) .filter(|p| self.res.facts.get(self.world.block(p.0, p.1, p.2)).name == hopper) .collect(); positions.sort_unstable();