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 <noreply@anthropic.com>
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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']
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user