Random-tick only sections holding randomly ticking states

The client random-ticked every section with a non-air block, drawing
getBlockRandomPos positions vanilla never draws. It now ticks a section only
when its palette holds a randomly ticking state, as
LevelChunkSection.isRandomlyTicking does (lava counts through LiquidBlock).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-10 20:02:40 +02:00
parent 58fe23d330
commit f58413cbbf
2 changed files with 8 additions and 4 deletions
+5 -1
View File
@@ -1318,15 +1318,19 @@ impl Game<'_> {
);
let simulation = self.settings.render_distance.min(8);
let mut ticking = Vec::new();
let facts = &self.res.facts;
for (&(x, z), chunk) in &self.world.chunks {
if (x - pcx).abs() > simulation || (z - pcz).abs() > simulation || !chunk.lit {
continue;
}
// LevelChunkSection.isRandomlyTicking: a randomly ticking block or
// fluid state (lava reports both through LiquidBlock). The palette
// stands in for vanilla's exact counts.
let sections: Vec<i32> = chunk
.sections
.iter()
.enumerate()
.filter(|(_, s)| !s.is_uniform(0))
.filter(|(_, s)| s.blocks.maybe_has(|id| facts.get(BlockStateId(id)).random_ticks))
.map(|(i, _)| MIN_Y + i as i32 * 16)
.collect();
ticking.push((x, z, sections));
+3 -3
View File
@@ -145,9 +145,9 @@ containers, weather-driven blocks. The library code lives in
- Features placed from block behaviour draw from a copy of the level
random. Their `next_world_*` draws and any draws in neighbour updates
during placement do not reach the real stream.
- Client sections that hold any non-air block get random ticks, not only
sections with randomly ticking states. This advances the
`getBlockRandomPos` generator more often than vanilla does.
- The client picks randomly ticking sections from their palettes, so a
section whose palette still lists a ticking state no block uses any more
gets random ticks that vanilla's exact counts would skip.
- **Explosion details.** Exposure uses full-collision blocks only.
`getEntities` order is approximate. Experience orbs, falling blocks and
arrows are not pushed.