From ee5e2de7bb84a38bd0309a639f16c037a23f7c02 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Thu, 8 Oct 2026 21:40:00 +0200 Subject: [PATCH] WIP snapshot: unfinished structures parity work (paused mid-task, may not build) Co-Authored-By: Claude Opus 5.5 --- .../horizon-world/examples/structure_blocks.rs | 3 ++- .../src/worldgen/generator_decoration.rs | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/crates/horizon-world/examples/structure_blocks.rs b/crates/horizon-world/examples/structure_blocks.rs index 6b333a301..ba2eea0b8 100644 --- a/crates/horizon-world/examples/structure_blocks.rs +++ b/crates/horizon-world/examples/structure_blocks.rs @@ -91,8 +91,9 @@ fn main() -> Result<(), Error> { Some(Tag::String(s)) => s.to_string_lossy(), _ => "-".into(), }; + // The seed only matters (and is only reported) with a loot table. let seed = match nbt.get(&"LootTableSeed".into()) { - Some(Tag::Long(v)) => v.to_string(), + Some(Tag::Long(v)) if text("LootTable") != "-" => v.to_string(), _ => "-".into(), }; println!("be {x} {y} {z} {} {} {seed}", text("id"), text("LootTable")); diff --git a/crates/horizon-world/src/worldgen/generator_decoration.rs b/crates/horizon-world/src/worldgen/generator_decoration.rs index 67139a43a..622ca8dfc 100644 --- a/crates/horizon-world/src/worldgen/generator_decoration.rs +++ b/crates/horizon-world/src/worldgen/generator_decoration.rs @@ -620,6 +620,15 @@ impl PlacementContext for World<'_> { state: BlockStateId, position: [i32; 3], ) -> Result { + if let (None, Some(behaviours)) = (self.blocks, self.behaviours) { + let mut level = ShapeLevel { + world: self, + random: horizon_core::random::LegacyRandom::new(0), + }; + let mut ticks = crate::level::Ticks::new(0); + let pos = BlockPos::new(position[0], position[1], position[2]); + return Ok(behaviours.can_survive(&mut level, &mut ticks, pos, state)); + } let blocks = self.blocks()?; blocks .survival @@ -640,6 +649,11 @@ impl PlacementContext for World<'_> { position: [i32; 3], direction: Direction, ) -> Result { + // Without the exported support tables, fall back to the gameplay + // behaviour's empty-level sturdiness cache. + if let (None, Some(behaviours)) = (self.blocks, self.behaviours) { + return Ok(behaviours.is_face_sturdy(state, direction)); + } let support = self.blocks()?.support.clone(); support .is_face_sturdy(self, state, position, direction, SupportType::Full) @@ -651,6 +665,9 @@ impl PlacementContext for World<'_> { direction: Direction, ) -> Result { let state = self.region.block_state(position)?; + if let (None, Some(behaviours)) = (self.blocks, self.behaviours) { + return Ok(behaviours.is_face_sturdy_center(state, direction)); + } let support = self.blocks()?.support.clone(); support .is_face_sturdy(self, state, position, direction, SupportType::Center)