diff --git a/crates/horizon-client/src/game/dispense_fixture.rs b/crates/horizon-client/src/game/dispense_fixture.rs index 340172d61..7ad14cb07 100644 --- a/crates/horizon-client/src/game/dispense_fixture.rs +++ b/crates/horizon-client/src/game/dispense_fixture.rs @@ -92,11 +92,16 @@ impl Game<'_> { fn fixture_reset(&mut self, seed: i64) { self.world = World::new(self.res.facts.air, seed); + // The oracle level is plains everywhere (bone meal's flowers, freezing). + let plains = u32::from(self.res.biomes.id("minecraft:plains")); for cx in -2..=2 { for cz in -2..=2 { - self.world - .chunks - .insert((cx, cz), Arc::new(Chunk::empty(cx, cz))); + let mut chunk = Chunk::empty(cx, cz); + for section in &mut chunk.sections { + Arc::make_mut(section).biomes = + horizon_core::paletted::PalettedContainer::new(horizon_client::chunk::BIOME_STRATEGY, plains); + } + self.world.chunks.insert((cx, cz), Arc::new(chunk)); } } self.block_ticks = Ticks::new(0); @@ -125,6 +130,17 @@ impl Game<'_> { fn dispense_case(&mut self, case: &Value) -> Result> { let seed = case["seed"].as_i64().unwrap_or(0); self.fixture_reset(seed); + // The oracle level answers one sky and one block light everywhere. + let light = case["light"].as_array(); + let level = |i: usize, default: i64| { + light.and_then(|l| l.get(i)).and_then(Value::as_i64).unwrap_or(default) as u8 + }; + let packed = (level(0, 15) << 4) | level(1, 0); + for chunk in self.world.chunks.values_mut() { + for section in &mut Arc::make_mut(chunk).sections { + Arc::make_mut(section).light = horizon_client::chunk::Light::Uniform(packed); + } + } self.world.game_time = case["time"].as_i64().unwrap_or(0); // The oracle level's clock stands at day time 6000. self.world.day_time = 6000; diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDispenserOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDispenserOracle.java index 85ab872e5..2bc24d850 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDispenserOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDispenserOracle.java @@ -46,6 +46,7 @@ public final class VanillaDispenserOracle { case 1018 -> "minecraft:entity.blaze.shoot"; case 1051 -> "minecraft:entity.wind_charge.throw"; case 1505 -> "minecraft:item.bone_meal.use"; + case 1501 -> "minecraft:block.lava.extinguish"; case 1009 -> data == 0 ? "minecraft:block.fire.extinguish" : data == 1 ? "minecraft:block.generic.extinguish_fire" : null; case 2001 -> { BlockState state = Block.stateById(data); diff --git a/tools/test_dispenser_parity.py b/tools/test_dispenser_parity.py index 85d15a100..b7a076784 100644 --- a/tools/test_dispenser_parity.py +++ b/tools/test_dispenser_parity.py @@ -211,8 +211,17 @@ def build_scene(cells, states, rng, scene, front, facing): h.put(cells, at, states.get('air')) +def halves(states, name): + """Whether a block comes in an upper and a lower half (tall plants, dripleaves, pitchers).""" + name = name if ':' in name else 'minecraft:' + name + return any(states.facts.states[i][4].get('properties', {}).get('half') == 'upper' for i in states.facts.by_block[name]) + + def front_state(states, rng, name): """Mostly the default state, sometimes a random one (charges, honey, ages, lit...).""" + if halves(states, name): + # A lone half is not a world vanilla makes; the pair is placed by put_front. + return states.get(name) if name in ('respawn_anchor', 'beehive', 'bee_nest', 'campfire', 'candle', 'wheat', 'sweet_berry_bush', 'rail', 'powered_rail', 'candle_cake', 'soul_campfire') or rng.random() < 0.3: return states.any(rng, name) @@ -237,6 +246,12 @@ def cases(facts, count, seed, only): below = (dx, dy - 1, dz) palette = FRONT_FOR[bare] if bare in FRONT_FOR and rng.random() < 0.8 else FRONT[kind] front_name = rng.choice(palette) + above = (dx, dy + 1, dz) + if halves(states, front_name) and front_name != 'pitcher_crop': + if above == (0, 0, 0): + front_name = 'air' + else: + h.put(cells, above, states.get(front_name, half='upper')) if front_name != 'air': h.put(cells, front, front_state(states, rng, front_name)) if below != (0, 0, 0) and rng.random() < 0.8: