steel_registry/structure/set.rs
1//! Structure set data types for generated registry data.
2//!
3//! These are simple data containers populated by the build script from
4//! the vanilla datapack JSONs. `steel-core` converts these into its
5//! placement types for actual worldgen logic.
6
7pub use crate::structure::{DimensionPadding, JigsawConfig, PoolAlias, StartHeight};
8use glam::IVec3;
9use steel_utils::Identifier;
10
11/// A structure set entry from the vanilla datapack.
12#[derive(Debug, Clone)]
13pub struct StructureSetData {
14 /// Registry key (e.g., `minecraft:villages`).
15 pub key: Identifier,
16 /// Weighted structure entries.
17 pub structures: Vec<StructureEntryData>,
18 /// Placement configuration.
19 pub placement: PlacementData,
20}
21
22/// A weighted structure entry within a structure set.
23#[derive(Debug, Clone)]
24pub struct StructureEntryData {
25 /// Structure identifier (e.g., `minecraft:village_plains`).
26 pub structure: Identifier,
27 /// Selection weight.
28 pub weight: i32,
29}
30
31/// Placement configuration from the vanilla datapack.
32#[derive(Debug, Clone)]
33pub enum PlacementData {
34 /// Grid-based spread placement (`minecraft:random_spread`).
35 RandomSpread {
36 /// Chunk spacing between grid cell centers.
37 spacing: i32,
38 /// Minimum chunk separation.
39 separation: i32,
40 /// Spread type: `"linear"` or `"triangular"`.
41 spread_type: SpreadTypeData,
42 /// Unique seed modifier.
43 salt: i32,
44 /// Generation probability (0.0–1.0). Default: 1.0.
45 frequency: f32,
46 /// Frequency reduction method name. Default: `"default"`.
47 frequency_reduction_method: FrequencyMethodData,
48 /// Exclusion zone: (`other_set` key, `chunk_count`).
49 exclusion_zone: Option<ExclusionZoneData>,
50 /// Block offset from the placement chunk used by `/locate`.
51 locate_offset: IVec3,
52 },
53 /// Ring-based placement (`minecraft:concentric_rings`).
54 ConcentricRings {
55 /// Base distance between rings (in chunks).
56 distance: i32,
57 /// Positions spread per ring.
58 spread: i32,
59 /// Total positions.
60 count: i32,
61 /// Biomes that ring positions prefer to snap to.
62 preferred_biomes: Vec<Identifier>,
63 /// Unique seed modifier.
64 salt: i32,
65 /// Generation probability. Default: 1.0.
66 frequency: f32,
67 /// Frequency reduction method name.
68 frequency_reduction_method: FrequencyMethodData,
69 /// Block offset from the placement chunk used by `/locate`.
70 locate_offset: IVec3,
71 },
72}
73
74/// Spread type for random spread placement.
75#[derive(Debug, Clone, Copy)]
76pub enum SpreadTypeData {
77 /// Uniform random.
78 Linear,
79 /// Biased toward center.
80 Triangular,
81}
82
83/// Frequency reduction method identifier.
84#[derive(Debug, Clone, Copy)]
85pub enum FrequencyMethodData {
86 /// Standard method.
87 Default,
88 /// Pillager outpost legacy.
89 LegacyType1,
90 /// Hardcoded salt legacy.
91 LegacyType2,
92 /// Double-precision legacy.
93 LegacyType3,
94}
95
96/// Exclusion zone preventing overlap with another structure set.
97#[derive(Debug, Clone)]
98pub struct ExclusionZoneData {
99 /// Registry key of the other structure set.
100 pub other_set: Identifier,
101 /// Radius in chunks.
102 pub chunk_count: i32,
103}