Match vanilla random ticks on every comparable case

The random tick oracle now stands on a real overworld: the data pack's
dimension type (for fire's infiniburn tag), its attributes and day timeline
on a clock at the fixture's day time, level data for difficulty, and block
scans that walk positions in BlockScanUtils' section order, since 26.3 reads
chunk sections the map-backed level does not have.

Horizon now rolls the nether portal's zombified piglin spawn with the level
random (the client spawns it near a player), rechecks chest and ender chest
openers through a new block entity hook and broadcasts the lid event, gives
melting ice and placed sniffer eggs their game events, and reads the weather
age of copper golem statues, which name the field weatheringState. The
fixture prints empty dispensers, crafters, ghastling spawns and fresh
shriekers as vanilla resolves them.

Random ticks match on 39,998 of 39,998 compared cases (two propagules cannot
grow trees in the oracle), block updates on 40,000 of 40,000 and redstone on
3,999 of 4,000.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-10 18:51:18 +02:00
parent 1344df60f0
commit 11b8a98ff5
9 changed files with 227 additions and 8 deletions
+5
View File
@@ -1552,6 +1552,11 @@ impl Game<'_> {
kind: "hatch_sniffer",
..
} => self.hatch_sniffer([pos.x, pos.y, pos.z]),
LevelEvent::BlockEvent {
pos,
kind: "portal_spawn",
..
} => self.portal_spawn([pos.x, pos.y, pos.z]),
LevelEvent::BlockEvent {
pos,
state,
+2
View File
@@ -547,6 +547,8 @@ impl Game<'_> {
block_drops: r.bool("block_drops"),
mob_griefing: r.bool("mob_griefing"),
max_snow_accumulation_height: r.int("max_snow_accumulation_height"),
spawn_mobs: r.bool("spawn_mobs"),
spawn_monsters: r.bool("spawn_monsters"),
}
}
/// Apply rules mirrored in other state (natural regeneration, difficulty).
@@ -2672,3 +2672,35 @@ fn push_apart(mobs: &mut [Mob]) {
}
}
}
impl Game<'_> {
/// The rest of `NetherPortalBlock.randomTick` after a won roll: with a
/// player close enough for spawning, a zombified piglin spawns on the block
/// under the portal column when it is a valid spawn.
pub(super) fn portal_spawn(&mut self, pos: [i32; 3]) {
// ChunkMap.anyPlayerCloseEnoughForSpawning: a non-spectator within 128
// blocks of the chunk centre.
let centre = [f64::from((pos[0] >> 4) * 16 + 8), f64::from((pos[2] >> 4) * 16 + 8)];
let spectator = self.spectator();
let Some(close) = self.player.as_ref().filter(|_| !spectator).map(|p| {
let (dx, dz) = (p.position.x - centre[0], p.position.z - centre[1]);
dx * dx + dz * dz < 16384.0
}) else {
return;
};
if !close {
return;
}
let mut y = pos[1];
while &*self.res.facts.get(self.world.block(pos[0], y, pos[2])).name == "minecraft:nether_portal" {
y -= 1;
}
// isValidSpawn: a sturdy top face (portal frames emit no light).
let below = self.res.facts.get(self.world.block(pos[0], y, pos[2]));
if below.sturdy_full & (1 << 1) == 0 {
return;
}
let at = [f64::from(pos[0]) + 0.5, f64::from(y + 1), f64::from(pos[2]) + 0.5];
let _ = self.spawn_mob("minecraft:zombified_piglin", at, false);
}
}