From b540ccb642a20d6a22c75383dd49fd4817410e95 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 18 Oct 2026 07:17:44 +0200 Subject: [PATCH] Brewing stands tick in the level's block entity ticker list Brewing stands were the last server ticker with a pass of its own over the whole block entity map every tick. They now tick in their place in Level.blockEntityTickers, as BrewingStandBlock.getTicker makes them: in list order, only in block-ticking range and inside the world border, with their bottle states written as each one ticks. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game.rs | 1 - .../src/game/block_entity_ticks.rs | 4 ++- crates/horizon-client/src/game/stations.rs | 32 +++++++++---------- tools/test_block_entity_tickers_parity.py | 4 +-- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs index 2ab3a7c07..d4a595a3f 100644 --- a/crates/horizon-client/src/game.rs +++ b/crates/horizon-client/src/game.rs @@ -3617,7 +3617,6 @@ impl Game<'_> { horizon_client::spans::time("tick_block_entities", || self.tick_block_entities())?; horizon_client::spans::time("tick_sculk_entities", || self.tick_sculk_entities()); horizon_client::spans::time("tick_sculk_blocks", || self.tick_sculk_blocks())?; - horizon_client::spans::time("tick_brewing_stands", || self.tick_brewing_stands())?; } if running { // ClientLevel.tickBlockEntities (not while paused or frozen): diff --git a/crates/horizon-client/src/game/block_entity_ticks.rs b/crates/horizon-client/src/game/block_entity_ticks.rs index afe1224fb..f596f2d8b 100644 --- a/crates/horizon-client/src/game/block_entity_ticks.rs +++ b/crates/horizon-client/src/game/block_entity_ticks.rs @@ -52,6 +52,7 @@ impl Game<'_> { Some(BlockEntity::Vault(_)) => self.tick_vault(pos)?, Some(BlockEntity::Beehive(_)) => self.tick_beehive(pos), Some(BlockEntity::Furnace(_)) => self.tick_furnace(pos)?, + Some(BlockEntity::Brewing(_)) => self.tick_brewing_stand(pos)?, _ => {} } } @@ -85,7 +86,8 @@ impl Game<'_> { | "minecraft:trial_spawner" | "minecraft:vault" | "minecraft:beehive" - | "minecraft:bee_nest" => Ticking::Yes, + | "minecraft:bee_nest" + | "minecraft:brewing_stand" => Ticking::Yes, "minecraft:jukebox" => { let record = registry .state(state) diff --git a/crates/horizon-client/src/game/stations.rs b/crates/horizon-client/src/game/stations.rs index 332f06b23..7b70cb1f1 100644 --- a/crates/horizon-client/src/game/stations.rs +++ b/crates/horizon-client/src/game/stations.rs @@ -2173,22 +2173,22 @@ impl Game<'_> { // ---------------------------------------------------------------- brewing stand - /// Ticks every brewing stand (`BrewingStandBlockEntity.serverTick`). - pub(super) fn tick_brewing_stands(&mut self) -> horizon_client::Result<()> { - let mut changes = Vec::new(); - for (pos, entity) in self.world.block_entities.iter_mut() { - if let BlockEntity::Brewing(b) = entity { - let out = b.tick( - &self.res.stations.brewing, - &self.res.items, - &self.res.providers, - ); - if out != brewing::BrewTick::default() { - changes.push((*pos, out)); - } - } - } - for ((x, y, z), out) in changes { + /// `BrewingStandBlockEntity.serverTick` of the brewing stand at `pos`, in + /// its place among the level's block entity tickers. + pub(super) fn tick_brewing_stand( + &mut self, + pos: (i32, i32, i32), + ) -> horizon_client::Result<()> { + let Some(BlockEntity::Brewing(b)) = self.world.block_entities.get_mut(&pos) else { + return Ok(()); + }; + let out = b.tick( + &self.res.stations.brewing, + &self.res.items, + &self.res.providers, + ); + if out != brewing::BrewTick::default() { + let (x, y, z) = pos; self.world.modified.insert((x >> 4, z >> 4)); if out.brewed { self.play_at("minecraft:block.brewing_stand.brew", [x, y, z], 1.0, 1.0); diff --git a/tools/test_block_entity_tickers_parity.py b/tools/test_block_entity_tickers_parity.py index 58604b269..459e7a926 100644 --- a/tools/test_block_entity_tickers_parity.py +++ b/tools/test_block_entity_tickers_parity.py @@ -9,7 +9,7 @@ of a server level and prints, after each tick, the positions of the live tickers in list order; `examples/block_entity_tickers_fixture` runs the same on `horizon_client::block_entities::BlockEntities`. The block entities are the kinds the game ticks in that list (hoppers, furnaces, beacons, spawners, -trial spawners, vaults, hives, crafters, jukebox), with chests and barrels, +trial spawners, vaults, hives, crafters, brewing stands, jukebox), with chests and barrels, which have no ticker, among them. """ import argparse @@ -25,7 +25,7 @@ except ImportError: PARITY = lab.ROOT / 'mods/horizon/src/test/java/dev/horizonlab/parity' TICKING = ['hopper', 'furnace', 'blast_furnace', 'smoker', 'beacon', 'spawner', 'trial_spawner', 'vault', - 'beehive', 'bee_nest', 'crafter', 'jukebox_record'] + 'beehive', 'bee_nest', 'crafter', 'brewing_stand', 'jukebox_record'] KINDS = TICKING + ['jukebox', 'chest', 'barrel']