Skip to main content

steel_worldgen/generated/vanilla_density_functions/
nether.rs

1use steel_registry::RegistryExt;
2use steel_registry::blocks::block_state_ext::BlockStateExt;
3use std::simd::Simd;
4use std::simd::Select;
5use std::simd::cmp::SimdOrd;
6use std::simd::cmp::SimdPartialEq;
7use std::simd::cmp::SimdPartialOrd;
8use std::simd::num::SimdInt;
9use std::simd::num::SimdFloat;
10use steel_worldgen::density::spline_eval;
11use steel_worldgen::density::RarityValueMapper;
12use steel_math::{clamp, map_clamped};
13use steel_worldgen::noise::NormalNoise;
14use steel_worldgen::random::{PositionalRandom, RandomSplitter};
15/// All noise generators needed by this dimension's density functions.
16///
17/// Created at runtime from a seed via the `create` method.
18pub struct NetherNoises {
19    pub n_nether__temperature: NormalNoise,
20    pub n_nether__vegetation: NormalNoise,
21    pub blended_noise: steel_worldgen::noise::BlendedNoise,
22}
23impl NetherNoises {
24    /// Create all noise generators from a world seed, positional splitter, and noise parameters.
25    pub fn create(
26        seed: u64,
27        splitter: &RandomSplitter,
28        params: &rustc_hash::FxHashMap<String, steel_worldgen::density::NoiseParameters>,
29    ) -> Self {
30        let _ = seed;
31        Self {
32            n_nether__temperature: {
33                let p = params
34                    .get("minecraft:nether/temperature")
35                    .expect(
36                        concat!("missing noise params: ", "minecraft:nether/temperature"),
37                    );
38                p.create(splitter, "minecraft:nether/temperature")
39            },
40            n_nether__vegetation: {
41                let p = params
42                    .get("minecraft:nether/vegetation")
43                    .expect(
44                        concat!("missing noise params: ", "minecraft:nether/vegetation"),
45                    );
46                p.create(splitter, "minecraft:nether/vegetation")
47            },
48            blended_noise: {
49                let mut rng = steel_worldgen::random::RandomSource::Legacy(
50                    steel_worldgen::random::legacy_random::LegacyRandom::from_seed(seed),
51                );
52                steel_worldgen::noise::BlendedNoise::new(
53                    &mut rng,
54                    0.25,
55                    0.375,
56                    80.0,
57                    60.0,
58                    8.0,
59                )
60            },
61        }
62    }
63}
64/// Column-level cache for xz-only density function results.
65///
66/// Supports two modes:
67/// - **Grid mode** (`init_grid()` called): Pre-computes a 2D grid of all
68///   in-chunk quart positions. `ensure()` does O(1) grid lookups for exact
69///   grid points and evaluates other positions on the fly.
70/// - **No-grid mode** (default): Single-entry lazy cache that recomputes
71///   when the exact coordinates change.
72#[derive(Clone)]
73pub struct NetherColumnCache {
74    /// Raw x block coordinate (for non-flat router functions).
75    pub x: i32,
76    /// Raw z block coordinate (for non-flat router functions).
77    pub z: i32,
78    /// X coordinate used to evaluate the cached values.
79    qx: i32,
80    /// Z coordinate used to evaluate the cached values.
81    qz: i32,
82    valid: bool,
83    grid_first_quart_x: i32,
84    grid_first_quart_z: i32,
85    has_grid: bool,
86    pub router_continentalness: f32,
87    pub router_depth: f32,
88    pub router_erosion: f32,
89    pub router_ridges: f32,
90    pub router_temperature: f32,
91    pub router_vegetation: f32,
92    grid_router_continentalness: [f32; 25],
93    grid_router_depth: [f32; 25],
94    grid_router_erosion: [f32; 25],
95    grid_router_ridges: [f32; 25],
96    grid_router_temperature: [f32; 25],
97    grid_router_vegetation: [f32; 25],
98}
99impl NetherColumnCache {
100    /// Grid side length (quart positions per axis).
101    const GRID_SIDE: i32 = 5;
102    /// Create a new column cache without a pre-computed grid.
103    #[must_use]
104    pub fn new() -> Self {
105        Self {
106            x: 0,
107            z: 0,
108            qx: i32::MIN,
109            qz: i32::MIN,
110            valid: false,
111            grid_first_quart_x: 0,
112            grid_first_quart_z: 0,
113            has_grid: false,
114            router_continentalness: 0.0,
115            router_depth: 0.0,
116            router_erosion: 0.0,
117            router_ridges: 0.0,
118            router_temperature: 0.0,
119            router_vegetation: 0.0,
120            grid_router_continentalness: [0.0; 25],
121            grid_router_depth: [0.0; 25],
122            grid_router_erosion: [0.0; 25],
123            grid_router_ridges: [0.0; 25],
124            grid_router_temperature: [0.0; 25],
125            grid_router_vegetation: [0.0; 25],
126        }
127    }
128    /// Pre-compute flat-cached values for all quart positions in a chunk.
129    ///
130    /// After this call, `ensure()` for matching grid points copies from
131    /// the grid (O(1)). Other positions are evaluated at their exact
132    /// coordinates.
133    pub fn init_grid(
134        &mut self,
135        chunk_block_x: i32,
136        chunk_block_z: i32,
137        noises: &NetherNoises,
138    ) {
139        self.grid_first_quart_x = chunk_block_x >> 2;
140        self.grid_first_quart_z = chunk_block_z >> 2;
141        self.has_grid = true;
142        self.valid = false;
143        for rel_z in 0..Self::GRID_SIDE {
144            for rel_x in 0..Self::GRID_SIDE {
145                let x = ((self.grid_first_quart_x + rel_x) << 2) as f64;
146                let z = ((self.grid_first_quart_z + rel_z) << 2) as f64;
147                let idx = (rel_z * Self::GRID_SIDE + rel_x) as usize;
148                let val = compute_router_continentalness(noises, &*self, x, z);
149                self.router_continentalness = val;
150                let val = compute_router_depth(noises, &*self, x, z);
151                self.router_depth = val;
152                let val = compute_router_erosion(noises, &*self, x, z);
153                self.router_erosion = val;
154                let val = compute_router_ridges(noises, &*self, x, z);
155                self.router_ridges = val;
156                let val = compute_router_temperature(noises, &*self, x, z);
157                self.router_temperature = val;
158                let val = compute_router_vegetation(noises, &*self, x, z);
159                self.router_vegetation = val;
160                self.grid_router_continentalness[idx] = self.router_continentalness;
161                self.grid_router_depth[idx] = self.router_depth;
162                self.grid_router_erosion[idx] = self.router_erosion;
163                self.grid_router_ridges[idx] = self.router_ridges;
164                self.grid_router_temperature[idx] = self.router_temperature;
165                self.grid_router_vegetation[idx] = self.router_vegetation;
166            }
167        }
168    }
169    /// Ensure the cache is populated for the given `(x, z)` block coordinates.
170    ///
171    /// Grid-aligned in-bounds positions load from the pre-computed grid.
172    /// Every other position is evaluated at its exact coordinates.
173    pub fn ensure(&mut self, x: i32, z: i32, noises: &NetherNoises) {
174        self.x = x;
175        self.z = z;
176        let quart_x = x >> 2;
177        let quart_z = z >> 2;
178        if self.has_grid {
179            let rel_x = quart_x - self.grid_first_quart_x;
180            let rel_z = quart_z - self.grid_first_quart_z;
181            if x & 3 == 0 && z & 3 == 0 && rel_x >= 0 && rel_z >= 0
182                && rel_x < Self::GRID_SIDE && rel_z < Self::GRID_SIDE
183            {
184                let eval_x = quart_x << 2;
185                let eval_z = quart_z << 2;
186                if self.valid && self.qx == eval_x && self.qz == eval_z {
187                    return;
188                }
189                let idx = (rel_z * Self::GRID_SIDE + rel_x) as usize;
190                self.router_continentalness = self.grid_router_continentalness[idx];
191                self.router_depth = self.grid_router_depth[idx];
192                self.router_erosion = self.grid_router_erosion[idx];
193                self.router_ridges = self.grid_router_ridges[idx];
194                self.router_temperature = self.grid_router_temperature[idx];
195                self.router_vegetation = self.grid_router_vegetation[idx];
196                self.qx = eval_x;
197                self.qz = eval_z;
198                self.valid = true;
199                return;
200            }
201            if self.valid && self.qx == x && self.qz == z {
202                return;
203            }
204            self.qx = x;
205            self.qz = z;
206            let x = x as f64;
207            let z = z as f64;
208            let val = compute_router_continentalness(noises, &*self, x, z);
209            self.router_continentalness = val;
210            let val = compute_router_depth(noises, &*self, x, z);
211            self.router_depth = val;
212            let val = compute_router_erosion(noises, &*self, x, z);
213            self.router_erosion = val;
214            let val = compute_router_ridges(noises, &*self, x, z);
215            self.router_ridges = val;
216            let val = compute_router_temperature(noises, &*self, x, z);
217            self.router_temperature = val;
218            let val = compute_router_vegetation(noises, &*self, x, z);
219            self.router_vegetation = val;
220            self.valid = true;
221            return;
222        }
223        if self.valid && self.qx == x && self.qz == z {
224            return;
225        }
226        self.qx = x;
227        self.qz = z;
228        let x = x as f64;
229        let z = z as f64;
230        let val = compute_router_continentalness(noises, &*self, x, z);
231        self.router_continentalness = val;
232        let val = compute_router_depth(noises, &*self, x, z);
233        self.router_depth = val;
234        let val = compute_router_erosion(noises, &*self, x, z);
235        self.router_erosion = val;
236        let val = compute_router_ridges(noises, &*self, x, z);
237        self.router_ridges = val;
238        let val = compute_router_temperature(noises, &*self, x, z);
239        self.router_temperature = val;
240        let val = compute_router_vegetation(noises, &*self, x, z);
241        self.router_vegetation = val;
242        self.valid = true;
243    }
244}
245///`minecraft:nether/base_3d_noise`
246#[inline]
247fn compute_nether__base_3d_noise(
248    noises: &NetherNoises,
249    cache: &NetherColumnCache,
250    x: f64,
251    y: f64,
252    z: f64,
253) -> f32 {
254    (noises.blended_noise.compute(x, y, z) as f32) as f32
255}
256#[inline]
257fn compute_nether__base_3d_noise_simd<const N: usize>(
258    noises: &NetherNoises,
259    cache: &NetherColumnCache,
260    x: f64,
261    ys: Simd<f64, N>,
262    z: f64,
263) -> Simd<f32, N> {
264    {
265        let __ys_arr = ys.to_array();
266        let mut __values = [0.0_f32; N];
267        for lane in 0..N {
268            #[allow(clippy::cast_possible_truncation)]
269            let y = __ys_arr[lane];
270            __values[lane] = (noises.blended_noise.compute(x, y, z) as f32) as f32;
271        }
272        Simd::from_array(__values)
273    }
274}
275/// Whether any aquifer router needs prepared column values.
276pub const AQUIFER_NEEDS_COLUMN_CACHE: bool = true;
277#[inline]
278fn compute_router_continentalness(
279    noises: &NetherNoises,
280    cache: &NetherColumnCache,
281    x: f64,
282    z: f64,
283) -> f32 {
284    (0.0) as f32
285}
286///Noise router entry: `continentalness`
287#[inline]
288pub fn router_continentalness(
289    noises: &NetherNoises,
290    cache: &NetherColumnCache,
291    x: f64,
292    y: f64,
293    z: f64,
294) -> f32 {
295    cache.router_continentalness
296}
297#[inline]
298fn compute_router_depth(
299    noises: &NetherNoises,
300    cache: &NetherColumnCache,
301    x: f64,
302    z: f64,
303) -> f32 {
304    (0.0) as f32
305}
306///Noise router entry: `depth`
307#[inline]
308pub fn router_depth(
309    noises: &NetherNoises,
310    cache: &NetherColumnCache,
311    x: f64,
312    y: f64,
313    z: f64,
314) -> f32 {
315    cache.router_depth
316}
317#[inline]
318fn compute_router_erosion(
319    noises: &NetherNoises,
320    cache: &NetherColumnCache,
321    x: f64,
322    z: f64,
323) -> f32 {
324    (0.0) as f32
325}
326///Noise router entry: `erosion`
327#[inline]
328pub fn router_erosion(
329    noises: &NetherNoises,
330    cache: &NetherColumnCache,
331    x: f64,
332    y: f64,
333    z: f64,
334) -> f32 {
335    cache.router_erosion
336}
337///Noise router entry: `final_density`
338#[inline]
339pub fn router_final_density(
340    noises: &NetherNoises,
341    cache: &NetherColumnCache,
342    x: f64,
343    y: f64,
344    z: f64,
345) -> f32 {
346    let x = cache.x as f64;
347    let z = cache.z as f64;
348    (((({
349        let c = ((((((({
350            let __lerp_alpha = ({
351                let __coordinate = (y as i32).clamp(-8, 24) - -8;
352                0.0 + __coordinate as f32 * ((1.0 - 0.0) / (24 - -8) as f32)
353            }) as f32;
354            if __lerp_alpha == 0.0 {
355                (2.5) as f32
356            } else if __lerp_alpha == 1.0 {
357                ({
358                    let __lerp_alpha = ({
359                        let __coordinate = (y as i32).clamp(104, 128) - 104;
360                        1.0 + __coordinate as f32 * ((0.0 - 1.0) / (128 - 104) as f32)
361                    }) as f32;
362                    if __lerp_alpha == 0.0 {
363                        (0.9375) as f32
364                    } else if __lerp_alpha == 1.0 {
365                        (compute_nether__base_3d_noise(noises, cache, x, y, z)) as f32
366                    } else {
367                        let __lerp_first = (0.9375) as f32;
368                        __lerp_first
369                            + __lerp_alpha
370                                * (((compute_nether__base_3d_noise(noises, cache, x, y, z))
371                                    as f32) - __lerp_first)
372                    }
373                }) as f32
374            } else {
375                let __lerp_first = (2.5) as f32;
376                __lerp_first
377                    + __lerp_alpha
378                        * ((({
379                            let __lerp_alpha = ({
380                                let __coordinate = (y as i32).clamp(104, 128) - 104;
381                                1.0
382                                    + __coordinate as f32 * ((0.0 - 1.0) / (128 - 104) as f32)
383                            }) as f32;
384                            if __lerp_alpha == 0.0 {
385                                (0.9375) as f32
386                            } else if __lerp_alpha == 1.0 {
387                                (compute_nether__base_3d_noise(noises, cache, x, y, z))
388                                    as f32
389                            } else {
390                                let __lerp_first = (0.9375) as f32;
391                                __lerp_first
392                                    + __lerp_alpha
393                                        * (((compute_nether__base_3d_noise(noises, cache, x, y, z))
394                                            as f32) - __lerp_first)
395                            }
396                        }) as f32) - __lerp_first)
397            }
398        }) as f32) as f32) * ((0.64) as f32))) as f32) as f32)
399            .clamp(-1.0, 1.0);
400        c / 2.0 - c * c * c / 24.0
401    }) as f32) + ((0.0) as f32))) as f32
402}
403#[inline]
404fn compute_router_ridges(
405    noises: &NetherNoises,
406    cache: &NetherColumnCache,
407    x: f64,
408    z: f64,
409) -> f32 {
410    (0.0) as f32
411}
412///Noise router entry: `ridges`
413#[inline]
414pub fn router_ridges(
415    noises: &NetherNoises,
416    cache: &NetherColumnCache,
417    x: f64,
418    y: f64,
419    z: f64,
420) -> f32 {
421    cache.router_ridges
422}
423#[inline]
424fn compute_router_temperature(
425    noises: &NetherNoises,
426    cache: &NetherColumnCache,
427    x: f64,
428    z: f64,
429) -> f32 {
430    (noises.n_nether__temperature.get_value_xz(x * 0.25, z * 0.25)) as f32
431}
432///Noise router entry: `temperature`
433#[inline]
434pub fn router_temperature(
435    noises: &NetherNoises,
436    cache: &NetherColumnCache,
437    x: f64,
438    y: f64,
439    z: f64,
440) -> f32 {
441    cache.router_temperature
442}
443#[inline]
444fn compute_router_vegetation(
445    noises: &NetherNoises,
446    cache: &NetherColumnCache,
447    x: f64,
448    z: f64,
449) -> f32 {
450    (noises.n_nether__vegetation.get_value_xz(x * 0.25, z * 0.25)) as f32
451}
452///Noise router entry: `vegetation`
453#[inline]
454pub fn router_vegetation(
455    noises: &NetherNoises,
456    cache: &NetherColumnCache,
457    x: f64,
458    y: f64,
459    z: f64,
460) -> f32 {
461    cache.router_vegetation
462}
463/// Total number of independently interpolated channels across all
464/// router entries (final_density + vein_toggle + vein_ridged).
465pub const INTERPOLATED_COUNT: usize = 1;
466/// Whether vein functions have interpolation channels.
467pub const VEIN_INTERP_ENABLED: bool = false;
468/// Channels that, when `<= 0` at a block, prove its combined final
469/// density is not positive. Check actual interpolated block values.
470pub const FINAL_DENSITY_NONPOSITIVE_CHANNELS: Option<&[usize]> = Some(&[0]);
471/// Evaluate the inner functions of all `Interpolated` markers at a cell corner.
472///
473/// `out` must have length `INTERPOLATED_COUNT`.
474#[expect(
475    unused_variables,
476    reason = "generated function has a fixed signature; blended_noise_value is unused in dimensions without blended noise"
477)]
478pub fn fill_cell_corner_densities(
479    noises: &NetherNoises,
480    cache: &NetherColumnCache,
481    x: i32,
482    y: i32,
483    z: i32,
484    blended_noise_value: f32,
485    out: &mut [f32],
486) {
487    let x = cache.x as f64;
488    let z = cache.z as f64;
489    let y = y as f64;
490    out[0] = ((((({
491        let __lerp_alpha = ({
492            let __coordinate = (y as i32).clamp(-8, 24) - -8;
493            0.0 + __coordinate as f32 * ((1.0 - 0.0) / (24 - -8) as f32)
494        }) as f32;
495        if __lerp_alpha == 0.0 {
496            (2.5) as f32
497        } else if __lerp_alpha == 1.0 {
498            ({
499                let __lerp_alpha = ({
500                    let __coordinate = (y as i32).clamp(104, 128) - 104;
501                    1.0 + __coordinate as f32 * ((0.0 - 1.0) / (128 - 104) as f32)
502                }) as f32;
503                if __lerp_alpha == 0.0 {
504                    (0.9375) as f32
505                } else if __lerp_alpha == 1.0 {
506                    ((blended_noise_value as f32) as f32) as f32
507                } else {
508                    let __lerp_first = (0.9375) as f32;
509                    __lerp_first
510                        + __lerp_alpha
511                            * ((((blended_noise_value as f32) as f32) as f32)
512                                - __lerp_first)
513                }
514            }) as f32
515        } else {
516            let __lerp_first = (2.5) as f32;
517            __lerp_first
518                + __lerp_alpha
519                    * ((({
520                        let __lerp_alpha = ({
521                            let __coordinate = (y as i32).clamp(104, 128) - 104;
522                            1.0
523                                + __coordinate as f32 * ((0.0 - 1.0) / (128 - 104) as f32)
524                        }) as f32;
525                        if __lerp_alpha == 0.0 {
526                            (0.9375) as f32
527                        } else if __lerp_alpha == 1.0 {
528                            ((blended_noise_value as f32) as f32) as f32
529                        } else {
530                            let __lerp_first = (0.9375) as f32;
531                            __lerp_first
532                                + __lerp_alpha
533                                    * ((((blended_noise_value as f32) as f32) as f32)
534                                        - __lerp_first)
535                        }
536                    }) as f32) - __lerp_first)
537        }
538    }) as f32) as f32) * ((0.64) as f32))) as f32;
539}
540/// SIMD form of [`fill_cell_corner_densities`] with a generic
541/// compile-time batch width.
542#[inline]
543pub fn fill_cell_corner_densities_y_simd<const N: usize>(
544    noises: &NetherNoises,
545    cache: &NetherColumnCache,
546    x: i32,
547    ys: [i32; N],
548    z: i32,
549    blended_noise_values: [f32; N],
550    out: &mut [f32],
551) {
552    let x = cache.x as f64;
553    let z = cache.z as f64;
554    let ys = Simd::from_array(ys.map(f64::from));
555    let blended_noise_value_v = Simd::from_array(blended_noise_values);
556    let __values_simd_0 = ((({
557        let __lerp_alpha = {
558            let __coordinate = ys
559                .cast::<i32>()
560                .simd_max(Simd::splat(-8))
561                .simd_min(Simd::splat(24)) - Simd::splat(-8);
562            Simd::<f32, N>::splat(0.0)
563                + __coordinate.cast::<f32>()
564                    * Simd::<f32, N>::splat((1.0 - 0.0) / (24 - -8) as f32)
565        };
566        let __zero = __lerp_alpha.simd_eq(Simd::<f32, N>::splat(0.0));
567        let __one = __lerp_alpha.simd_eq(Simd::<f32, N>::splat(1.0));
568        if __zero.all() {
569            Simd::<f32, N>::splat(2.5)
570        } else if __one.all() {
571            {
572                let __lerp_alpha = {
573                    let __coordinate = ys
574                        .cast::<i32>()
575                        .simd_max(Simd::splat(104))
576                        .simd_min(Simd::splat(128)) - Simd::splat(104);
577                    Simd::<f32, N>::splat(1.0)
578                        + __coordinate.cast::<f32>()
579                            * Simd::<f32, N>::splat((0.0 - 1.0) / (128 - 104) as f32)
580                };
581                let __zero = __lerp_alpha.simd_eq(Simd::<f32, N>::splat(0.0));
582                let __one = __lerp_alpha.simd_eq(Simd::<f32, N>::splat(1.0));
583                if __zero.all() {
584                    Simd::<f32, N>::splat(0.9375)
585                } else if __one.all() {
586                    blended_noise_value_v
587                } else {
588                    let __lerp_first = Simd::<f32, N>::splat(0.9375);
589                    let __lerp_second = blended_noise_value_v;
590                    let __lerp_value = __lerp_first
591                        + __lerp_alpha * (__lerp_second - __lerp_first);
592                    __zero
593                        .select(__lerp_first, __one.select(__lerp_second, __lerp_value))
594                }
595            }
596        } else {
597            let __lerp_first = Simd::<f32, N>::splat(2.5);
598            let __lerp_second = {
599                let __lerp_alpha = {
600                    let __coordinate = ys
601                        .cast::<i32>()
602                        .simd_max(Simd::splat(104))
603                        .simd_min(Simd::splat(128)) - Simd::splat(104);
604                    Simd::<f32, N>::splat(1.0)
605                        + __coordinate.cast::<f32>()
606                            * Simd::<f32, N>::splat((0.0 - 1.0) / (128 - 104) as f32)
607                };
608                let __zero = __lerp_alpha.simd_eq(Simd::<f32, N>::splat(0.0));
609                let __one = __lerp_alpha.simd_eq(Simd::<f32, N>::splat(1.0));
610                if __zero.all() {
611                    Simd::<f32, N>::splat(0.9375)
612                } else if __one.all() {
613                    blended_noise_value_v
614                } else {
615                    let __lerp_first = Simd::<f32, N>::splat(0.9375);
616                    let __lerp_second = blended_noise_value_v;
617                    let __lerp_value = __lerp_first
618                        + __lerp_alpha * (__lerp_second - __lerp_first);
619                    __zero
620                        .select(__lerp_first, __one.select(__lerp_second, __lerp_value))
621                }
622            };
623            let __lerp_value = __lerp_first
624                + __lerp_alpha * (__lerp_second - __lerp_first);
625            __zero.select(__lerp_first, __one.select(__lerp_second, __lerp_value))
626        }
627    }) * (Simd::<f32, N>::splat(0.64))))
628        .to_array();
629    for lane in 0..N {
630        out[lane * INTERPOLATED_COUNT + 0] = __values_simd_0[lane];
631    }
632}
633/// Combine interpolated values for `final_density`.
634#[expect(
635    unused_variables,
636    reason = "generated function has a fixed signature; not all parameters are used in every dimension"
637)]
638pub fn combine_interpolated(
639    noises: &NetherNoises,
640    cache: &NetherColumnCache,
641    interpolated: &[f32],
642    _x: i32,
643    y: i32,
644    _z: i32,
645) -> f32 {
646    let x = cache.x as f64;
647    let z = cache.z as f64;
648    let y = y as f64;
649    (((({
650        let c = ((interpolated[0]) as f32).clamp(-1.0, 1.0);
651        c / 2.0 - c * c * c / 24.0
652    }) as f32) + ((0.0) as f32))) as f32
653}
654/// Combine interpolated values for `vein_toggle`.
655#[expect(
656    unused_variables,
657    reason = "generated function has a fixed signature; not all parameters are used in every dimension"
658)]
659pub fn combine_vein_toggle(
660    noises: &NetherNoises,
661    cache: &NetherColumnCache,
662    interpolated: &[f32],
663    _x: i32,
664    y: i32,
665    _z: i32,
666) -> f32 {
667    let x = cache.x as f64;
668    let z = cache.z as f64;
669    let y = y as f64;
670    0.0
671}
672/// Combine interpolated values for `vein_ridged`.
673#[expect(
674    unused_variables,
675    reason = "generated function has a fixed signature; not all parameters are used in every dimension"
676)]
677pub fn combine_vein_ridged(
678    noises: &NetherNoises,
679    cache: &NetherColumnCache,
680    interpolated: &[f32],
681    _x: i32,
682    y: i32,
683    _z: i32,
684) -> f32 {
685    let x = cache.x as f64;
686    let z = cache.z as f64;
687    let y = y as f64;
688    0.0
689}
690/// Noise settings for this dimension, parsed from the datapack.
691pub struct NetherNoiseSettings;
692impl NetherNoiseSettings {
693    /// Minimum Y coordinate for this dimension.
694    pub const MIN_Y: i32 = 0i32;
695    /// Total height of the world in blocks.
696    pub const HEIGHT: i32 = 128i32;
697    /// Sea level Y coordinate.
698    pub const SEA_LEVEL: i32 = 32i32;
699    /// Cell width in blocks (XZ).
700    pub const CELL_WIDTH: i32 = 4i32;
701    /// Cell height in blocks (Y).
702    pub const CELL_HEIGHT: i32 = 8i32;
703    /// Whether aquifers are enabled.
704    pub const AQUIFERS_ENABLED: bool = false;
705    /// Whether ore veins are enabled.
706    pub const ORE_VEINS_ENABLED: bool = false;
707    /// Whether the material rule contains ore veins.
708    pub const MATERIAL_ORE_VEINS_ENABLED: bool = false;
709    /// Whether this dimension uses Java's LCG random (true) or Xoroshiro (false).
710    pub const LEGACY_RANDOM_SOURCE: bool = true;
711    /// Get the default block state ID for this dimension.
712    #[inline]
713    pub fn default_block_id() -> steel_utils::BlockStateId {
714        steel_registry::REGISTRY
715            .blocks
716            .get_default_state_id(&steel_registry::vanilla_blocks::NETHERRACK)
717    }
718    /// Get the default fluid state ID for this dimension.
719    #[inline]
720    pub fn default_fluid_id() -> steel_utils::BlockStateId {
721        steel_registry::REGISTRY
722            .blocks
723            .get_default_state_id(&steel_registry::vanilla_blocks::LAVA)
724    }
725}
726impl steel_worldgen::density::NoiseSettings for NetherNoiseSettings {
727    const MIN_Y: i32 = 0i32;
728    const HEIGHT: i32 = 128i32;
729    const SEA_LEVEL: i32 = 32i32;
730    const CELL_WIDTH: i32 = 4i32;
731    const CELL_HEIGHT: i32 = 8i32;
732    const AQUIFERS_ENABLED: bool = false;
733    const ORE_VEINS_ENABLED: bool = false;
734    const MATERIAL_ORE_VEINS_ENABLED: bool = false;
735    const LEGACY_RANDOM_SOURCE: bool = true;
736    #[inline]
737    fn default_block_id() -> steel_utils::BlockStateId {
738        NetherNoiseSettings::default_block_id()
739    }
740    #[inline]
741    fn default_fluid_id() -> steel_utils::BlockStateId {
742        NetherNoiseSettings::default_fluid_id()
743    }
744}
745impl Default for NetherColumnCache {
746    fn default() -> Self {
747        Self::new()
748    }
749}
750impl steel_worldgen::density::ColumnCache for NetherColumnCache {
751    type Noises = NetherNoises;
752    #[inline]
753    fn ensure(&mut self, x: i32, z: i32, noises: &Self::Noises) {
754        NetherColumnCache::ensure(self, x, z, noises)
755    }
756    #[inline]
757    fn init_grid(
758        &mut self,
759        chunk_block_x: i32,
760        chunk_block_z: i32,
761        noises: &Self::Noises,
762    ) {
763        NetherColumnCache::init_grid(self, chunk_block_x, chunk_block_z, noises)
764    }
765}
766impl steel_worldgen::density::DimensionNoises for NetherNoises {
767    type ColumnCache = NetherColumnCache;
768    type Settings = NetherNoiseSettings;
769    fn create(
770        seed: u64,
771        splitter: &steel_utils::random::RandomSplitter,
772        params: &rustc_hash::FxHashMap<String, steel_worldgen::density::NoiseParameters>,
773    ) -> Self {
774        NetherNoises::create(seed, splitter, params)
775    }
776    #[inline]
777    fn router_final_density(
778        &self,
779        cache: &mut Self::ColumnCache,
780        x: i32,
781        y: i32,
782        z: i32,
783    ) -> f32 {
784        router_final_density(self, cache, x as f64, y as f64, z as f64)
785    }
786    #[inline]
787    fn router_depth(
788        &self,
789        cache: &mut Self::ColumnCache,
790        x: i32,
791        y: i32,
792        z: i32,
793    ) -> f32 {
794        router_depth(self, cache, x as f64, y as f64, z as f64)
795    }
796    #[inline]
797    fn aquifer_needs_column_cache() -> bool {
798        AQUIFER_NEEDS_COLUMN_CACHE
799    }
800    #[inline]
801    fn router_barrier(
802        &self,
803        cache: &mut Self::ColumnCache,
804        x: i32,
805        y: i32,
806        z: i32,
807    ) -> f32 {
808        0.0
809    }
810    #[inline]
811    fn router_fluid_level_floodedness(
812        &self,
813        cache: &mut Self::ColumnCache,
814        x: i32,
815        y: i32,
816        z: i32,
817    ) -> f32 {
818        0.0
819    }
820    #[inline]
821    fn router_fluid_level_spread(
822        &self,
823        cache: &mut Self::ColumnCache,
824        x: i32,
825        y: i32,
826        z: i32,
827    ) -> f32 {
828        0.0
829    }
830    #[inline]
831    fn router_lava(&self, cache: &mut Self::ColumnCache, x: i32, y: i32, z: i32) -> f32 {
832        0.0
833    }
834    #[inline]
835    fn router_vein_toggle(
836        &self,
837        cache: &mut Self::ColumnCache,
838        x: i32,
839        y: i32,
840        z: i32,
841    ) -> f32 {
842        0.0
843    }
844    #[inline]
845    fn router_vein_ridged(
846        &self,
847        cache: &mut Self::ColumnCache,
848        x: i32,
849        y: i32,
850        z: i32,
851    ) -> f32 {
852        0.0
853    }
854    #[inline]
855    fn router_vein_gap(
856        &self,
857        cache: &mut Self::ColumnCache,
858        x: i32,
859        y: i32,
860        z: i32,
861    ) -> f32 {
862        0.0
863    }
864    #[inline]
865    fn router_preliminary_surface_level(
866        &self,
867        cache: &mut Self::ColumnCache,
868        x: i32,
869        y: i32,
870        z: i32,
871    ) -> f32 {
872        0.0
873    }
874    #[inline]
875    fn router_erosion(
876        &self,
877        cache: &mut Self::ColumnCache,
878        x: i32,
879        y: i32,
880        z: i32,
881    ) -> f32 {
882        router_erosion(self, cache, x as f64, y as f64, z as f64)
883    }
884    #[inline]
885    fn router_continentalness(
886        &self,
887        cache: &mut Self::ColumnCache,
888        x: i32,
889        y: i32,
890        z: i32,
891    ) -> f32 {
892        router_continentalness(self, cache, x as f64, y as f64, z as f64)
893    }
894    #[inline]
895    fn router_temperature(
896        &self,
897        cache: &mut Self::ColumnCache,
898        x: i32,
899        y: i32,
900        z: i32,
901    ) -> f32 {
902        router_temperature(self, cache, x as f64, y as f64, z as f64)
903    }
904    #[inline]
905    fn router_vegetation(
906        &self,
907        cache: &mut Self::ColumnCache,
908        x: i32,
909        y: i32,
910        z: i32,
911    ) -> f32 {
912        router_vegetation(self, cache, x as f64, y as f64, z as f64)
913    }
914    #[inline]
915    fn router_ridges(
916        &self,
917        cache: &mut Self::ColumnCache,
918        x: i32,
919        y: i32,
920        z: i32,
921    ) -> f32 {
922        router_ridges(self, cache, x as f64, y as f64, z as f64)
923    }
924    #[inline]
925    fn interpolated_count() -> usize {
926        INTERPOLATED_COUNT
927    }
928    fn vein_interp_enabled() -> bool {
929        VEIN_INTERP_ENABLED
930    }
931    #[inline]
932    fn final_density_nonpositive_channels() -> Option<&'static [usize]> {
933        FINAL_DENSITY_NONPOSITIVE_CHANNELS
934    }
935    #[inline]
936    fn compute_noise_column(&self, x: i32, block_ys: &[i32], z: i32, out: &mut [f32]) {
937        self.blended_noise.compute_column(x, block_ys, z, out);
938    }
939    #[inline]
940    fn fill_cell_corner_densities(
941        &self,
942        cache: &mut Self::ColumnCache,
943        x: i32,
944        y: i32,
945        z: i32,
946        blended_noise_value: f32,
947        out: &mut [f32],
948    ) {
949        fill_cell_corner_densities(self, cache, x, y, z, blended_noise_value, out)
950    }
951    #[inline]
952    fn fill_cell_corner_densities_y_simd<const N: usize>(
953        &self,
954        cache: &mut Self::ColumnCache,
955        x: i32,
956        ys: [i32; N],
957        z: i32,
958        blended_noise_values: [f32; N],
959        out: &mut [f32],
960    ) {
961        fill_cell_corner_densities_y_simd::<
962            N,
963        >(self, cache, x, ys, z, blended_noise_values, out)
964    }
965    #[inline]
966    fn combine_interpolated(
967        &self,
968        cache: &mut Self::ColumnCache,
969        interpolated: &[f32],
970        x: i32,
971        y: i32,
972        z: i32,
973    ) -> f32 {
974        combine_interpolated(self, cache, interpolated, x, y, z)
975    }
976    #[inline]
977    fn combine_vein_toggle(
978        &self,
979        cache: &mut Self::ColumnCache,
980        interpolated: &[f32],
981        x: i32,
982        y: i32,
983        z: i32,
984    ) -> f32 {
985        combine_vein_toggle(self, cache, interpolated, x, y, z)
986    }
987    #[inline]
988    fn combine_vein_ridged(
989        &self,
990        cache: &mut Self::ColumnCache,
991        interpolated: &[f32],
992        x: i32,
993        y: i32,
994        z: i32,
995    ) -> f32 {
996        combine_vein_ridged(self, cache, interpolated, x, y, z)
997    }
998    fn surface_noise_ids() -> &'static [&'static str] {
999        &[
1000            "minecraft:patch",
1001            "minecraft:nether_state_selector",
1002            "minecraft:netherrack",
1003            "minecraft:nether_wart",
1004            "minecraft:soul_sand_layer",
1005            "minecraft:gravel_layer",
1006        ]
1007    }
1008    fn surface_gradient_ids() -> &'static [&'static str] {
1009        &["minecraft:bedrock_floor", "minecraft:bedrock_roof"]
1010    }
1011    fn surface_rule_block_states() -> &'static [steel_utils::BlockStateId] {
1012        {
1013            static BLOCK_STATES: std::sync::OnceLock<Box<[steel_utils::BlockStateId]>> = std::sync::OnceLock::new();
1014            BLOCK_STATES
1015                .get_or_init(|| {
1016                    Box::from([
1017                        steel_registry::vanilla_blocks::BEDROCK.default_state(),
1018                        steel_registry::vanilla_blocks::NETHERRACK.default_state(),
1019                        steel_registry::vanilla_blocks::BASALT.default_state(),
1020                        steel_registry::vanilla_blocks::GRAVEL.default_state(),
1021                        steel_registry::vanilla_blocks::BLACKSTONE.default_state(),
1022                        steel_registry::vanilla_blocks::SOUL_SAND.default_state(),
1023                        steel_registry::vanilla_blocks::SOUL_SOIL.default_state(),
1024                        steel_registry::vanilla_blocks::LAVA.default_state(),
1025                        steel_registry::vanilla_blocks::WARPED_WART_BLOCK
1026                            .default_state(),
1027                        steel_registry::vanilla_blocks::WARPED_NYLIUM.default_state(),
1028                        steel_registry::vanilla_blocks::NETHER_WART_BLOCK
1029                            .default_state(),
1030                        steel_registry::vanilla_blocks::CRIMSON_NYLIUM.default_state(),
1031                    ])
1032                })
1033        }
1034    }
1035    fn surface_rule_uses_biome() -> bool {
1036        true
1037    }
1038    fn surface_rule_biome_sets() -> &'static [Box<[u16]>] {
1039        {
1040            static BIOME_SETS: std::sync::OnceLock<Box<[Box<[u16]>]>> = std::sync::OnceLock::new();
1041            BIOME_SETS
1042                .get_or_init(|| Box::from([
1043                    Box::from([
1044                        steel_registry::RegistryEntry::id(
1045                            &*steel_registry::vanilla_biomes::BASALT_DELTAS,
1046                        ) as u16,
1047                    ]),
1048                    Box::from([
1049                        steel_registry::RegistryEntry::id(
1050                            &*steel_registry::vanilla_biomes::SOUL_SAND_VALLEY,
1051                        ) as u16,
1052                    ]),
1053                    Box::from([
1054                        steel_registry::RegistryEntry::id(
1055                            &*steel_registry::vanilla_biomes::WARPED_FOREST,
1056                        ) as u16,
1057                    ]),
1058                    Box::from([
1059                        steel_registry::RegistryEntry::id(
1060                            &*steel_registry::vanilla_biomes::CRIMSON_FOREST,
1061                        ) as u16,
1062                    ]),
1063                    Box::from([
1064                        steel_registry::RegistryEntry::id(
1065                            &*steel_registry::vanilla_biomes::NETHER_WASTES,
1066                        ) as u16,
1067                    ]),
1068                ]))
1069        }
1070    }
1071    fn surface_rule_below_preliminary_surface() -> &'static steel_worldgen::surface_partial::PartialSurfaceRule {
1072        static RULE: steel_worldgen::surface_partial::PartialSurfaceRule = steel_worldgen::surface_partial::PartialSurfaceRule::Sequence(
1073            &[
1074                steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1075                    steel_worldgen::surface_partial::PartialSurfaceCondition::VerticalGradient {
1076                        true_at_and_below: 0i32,
1077                        false_at_and_above: 5i32,
1078                    },
1079                    &steel_worldgen::surface_partial::PartialSurfaceRule::Block(0usize),
1080                ),
1081                steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1082                    steel_worldgen::surface_partial::PartialSurfaceCondition::Not(
1083                        &steel_worldgen::surface_partial::PartialSurfaceCondition::VerticalGradient {
1084                            true_at_and_below: 122i32,
1085                            false_at_and_above: 127i32,
1086                        },
1087                    ),
1088                    &steel_worldgen::surface_partial::PartialSurfaceRule::Block(0usize),
1089                ),
1090                steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1091                    steel_worldgen::surface_partial::PartialSurfaceCondition::YAtLeast(
1092                        122i32,
1093                    ),
1094                    &steel_worldgen::surface_partial::PartialSurfaceRule::Block(1usize),
1095                ),
1096                steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1097                    steel_worldgen::surface_partial::PartialSurfaceCondition::BiomeSet(
1098                        0usize,
1099                    ),
1100                    &steel_worldgen::surface_partial::PartialSurfaceRule::Sequence(
1101                        &[
1102                            steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1103                                steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1104                                &steel_worldgen::surface_partial::PartialSurfaceRule::Block(
1105                                    2usize,
1106                                ),
1107                            ),
1108                            steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1109                                steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1110                                &steel_worldgen::surface_partial::PartialSurfaceRule::Sequence(
1111                                    &[
1112                                        steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1113                                            steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1114                                            &steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1115                                                steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1116                                                &steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1117                                                    steel_worldgen::surface_partial::PartialSurfaceCondition::Not(
1118                                                        &steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1119                                                    ),
1120                                                    &steel_worldgen::surface_partial::PartialSurfaceRule::Block(
1121                                                        3usize,
1122                                                    ),
1123                                                ),
1124                                            ),
1125                                        ),
1126                                        steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1127                                            steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1128                                            &steel_worldgen::surface_partial::PartialSurfaceRule::Block(
1129                                                2usize,
1130                                            ),
1131                                        ),
1132                                        steel_worldgen::surface_partial::PartialSurfaceRule::Block(
1133                                            4usize,
1134                                        ),
1135                                    ],
1136                                ),
1137                            ),
1138                        ],
1139                    ),
1140                ),
1141                steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1142                    steel_worldgen::surface_partial::PartialSurfaceCondition::BiomeSet(
1143                        1usize,
1144                    ),
1145                    &steel_worldgen::surface_partial::PartialSurfaceRule::Sequence(
1146                        &[
1147                            steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1148                                steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1149                                &steel_worldgen::surface_partial::PartialSurfaceRule::Sequence(
1150                                    &[
1151                                        steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1152                                            steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1153                                            &steel_worldgen::surface_partial::PartialSurfaceRule::Block(
1154                                                5usize,
1155                                            ),
1156                                        ),
1157                                        steel_worldgen::surface_partial::PartialSurfaceRule::Block(
1158                                            6usize,
1159                                        ),
1160                                    ],
1161                                ),
1162                            ),
1163                            steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1164                                steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1165                                &steel_worldgen::surface_partial::PartialSurfaceRule::Sequence(
1166                                    &[
1167                                        steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1168                                            steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1169                                            &steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1170                                                steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1171                                                &steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1172                                                    steel_worldgen::surface_partial::PartialSurfaceCondition::Not(
1173                                                        &steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1174                                                    ),
1175                                                    &steel_worldgen::surface_partial::PartialSurfaceRule::Block(
1176                                                        3usize,
1177                                                    ),
1178                                                ),
1179                                            ),
1180                                        ),
1181                                        steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1182                                            steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1183                                            &steel_worldgen::surface_partial::PartialSurfaceRule::Block(
1184                                                5usize,
1185                                            ),
1186                                        ),
1187                                        steel_worldgen::surface_partial::PartialSurfaceRule::Block(
1188                                            6usize,
1189                                        ),
1190                                    ],
1191                                ),
1192                            ),
1193                        ],
1194                    ),
1195                ),
1196                steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1197                    steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1198                    &steel_worldgen::surface_partial::PartialSurfaceRule::Sequence(
1199                        &[
1200                            steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1201                                steel_worldgen::surface_partial::PartialSurfaceCondition::Not(
1202                                    &steel_worldgen::surface_partial::PartialSurfaceCondition::YAtLeast(
1203                                        32i32,
1204                                    ),
1205                                ),
1206                                &steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1207                                    steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1208                                    &steel_worldgen::surface_partial::PartialSurfaceRule::Block(
1209                                        7usize,
1210                                    ),
1211                                ),
1212                            ),
1213                            steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1214                                steel_worldgen::surface_partial::PartialSurfaceCondition::BiomeSet(
1215                                    2usize,
1216                                ),
1217                                &steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1218                                    steel_worldgen::surface_partial::PartialSurfaceCondition::Not(
1219                                        &steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1220                                    ),
1221                                    &steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1222                                        steel_worldgen::surface_partial::PartialSurfaceCondition::YAtLeast(
1223                                            31i32,
1224                                        ),
1225                                        &steel_worldgen::surface_partial::PartialSurfaceRule::Sequence(
1226                                            &[
1227                                                steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1228                                                    steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1229                                                    &steel_worldgen::surface_partial::PartialSurfaceRule::Block(
1230                                                        8usize,
1231                                                    ),
1232                                                ),
1233                                                steel_worldgen::surface_partial::PartialSurfaceRule::Block(
1234                                                    9usize,
1235                                                ),
1236                                            ],
1237                                        ),
1238                                    ),
1239                                ),
1240                            ),
1241                            steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1242                                steel_worldgen::surface_partial::PartialSurfaceCondition::BiomeSet(
1243                                    3usize,
1244                                ),
1245                                &steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1246                                    steel_worldgen::surface_partial::PartialSurfaceCondition::Not(
1247                                        &steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1248                                    ),
1249                                    &steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1250                                        steel_worldgen::surface_partial::PartialSurfaceCondition::YAtLeast(
1251                                            31i32,
1252                                        ),
1253                                        &steel_worldgen::surface_partial::PartialSurfaceRule::Sequence(
1254                                            &[
1255                                                steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1256                                                    steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1257                                                    &steel_worldgen::surface_partial::PartialSurfaceRule::Block(
1258                                                        10usize,
1259                                                    ),
1260                                                ),
1261                                                steel_worldgen::surface_partial::PartialSurfaceRule::Block(
1262                                                    11usize,
1263                                                ),
1264                                            ],
1265                                        ),
1266                                    ),
1267                                ),
1268                            ),
1269                        ],
1270                    ),
1271                ),
1272                steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1273                    steel_worldgen::surface_partial::PartialSurfaceCondition::BiomeSet(
1274                        4usize,
1275                    ),
1276                    &steel_worldgen::surface_partial::PartialSurfaceRule::Sequence(
1277                        &[
1278                            steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1279                                steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1280                                &steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1281                                    steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1282                                    &steel_worldgen::surface_partial::PartialSurfaceRule::Sequence(
1283                                        &[
1284                                            steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1285                                                steel_worldgen::surface_partial::PartialSurfaceCondition::Not(
1286                                                    &steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1287                                                ),
1288                                                &steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1289                                                    steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1290                                                    &steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1291                                                        steel_worldgen::surface_partial::PartialSurfaceCondition::Not(
1292                                                            &steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1293                                                        ),
1294                                                        &steel_worldgen::surface_partial::PartialSurfaceRule::Block(
1295                                                            5usize,
1296                                                        ),
1297                                                    ),
1298                                                ),
1299                                            ),
1300                                            steel_worldgen::surface_partial::PartialSurfaceRule::Block(
1301                                                1usize,
1302                                            ),
1303                                        ],
1304                                    ),
1305                                ),
1306                            ),
1307                            steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1308                                steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1309                                &steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1310                                    steel_worldgen::surface_partial::PartialSurfaceCondition::YAtLeast(
1311                                        31i32,
1312                                    ),
1313                                    &steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1314                                        steel_worldgen::surface_partial::PartialSurfaceCondition::Not(
1315                                            &steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1316                                        ),
1317                                        &steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1318                                            steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1319                                            &steel_worldgen::surface_partial::PartialSurfaceRule::Sequence(
1320                                                &[
1321                                                    steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1322                                                        steel_worldgen::surface_partial::PartialSurfaceCondition::YAtLeast(
1323                                                            32i32,
1324                                                        ),
1325                                                        &steel_worldgen::surface_partial::PartialSurfaceRule::Block(
1326                                                            3usize,
1327                                                        ),
1328                                                    ),
1329                                                    steel_worldgen::surface_partial::PartialSurfaceRule::Condition(
1330                                                        steel_worldgen::surface_partial::PartialSurfaceCondition::Not(
1331                                                            &steel_worldgen::surface_partial::PartialSurfaceCondition::Opaque,
1332                                                        ),
1333                                                        &steel_worldgen::surface_partial::PartialSurfaceRule::Block(
1334                                                            3usize,
1335                                                        ),
1336                                                    ),
1337                                                ],
1338                                            ),
1339                                        ),
1340                                    ),
1341                                ),
1342                            ),
1343                        ],
1344                    ),
1345                ),
1346                steel_worldgen::surface_partial::PartialSurfaceRule::Block(1usize),
1347            ],
1348        );
1349        &RULE
1350    }
1351    fn surface_rule_uses_preliminary_surface() -> bool {
1352        false
1353    }
1354    fn surface_rule_uses_surface_secondary() -> bool {
1355        false
1356    }
1357    fn surface_rule_uses_steep() -> bool {
1358        false
1359    }
1360    fn try_apply_surface_rule(
1361        ctx: &mut steel_worldgen::surface::SurfaceRuleContext<'_>,
1362    ) -> Option<steel_utils::BlockStateId> {
1363        Self::apply_surface_rule_impl(ctx)
1364    }
1365    fn material_ore_vein_value_count() -> usize {
1366        0usize
1367    }
1368    fn material_ore_vein_value_height() -> usize {
1369        0usize
1370    }
1371    fn fill_material_ore_vein_values(
1372        &self,
1373        cache: &mut Self::ColumnCache,
1374        interpolated: &[f32],
1375        x: i32,
1376        y: i32,
1377        z: i32,
1378        out: &mut [f32],
1379    ) {}
1380    fn fill_prefilled_material_ore_vein_results(
1381        &self,
1382        cache: &mut Self::ColumnCache,
1383        ore_veinifier: &steel_worldgen::noise::OreVeinifier,
1384        values: &[f32],
1385        x: i32,
1386        y: i32,
1387        z: i32,
1388        out: &mut [Option<steel_utils::BlockStateId>],
1389    ) {
1390        let ore_vein_states: &[[steel_utils::BlockStateId; 3]] = {
1391            static ORE_VEIN_STATES: std::sync::OnceLock<
1392                Box<[[steel_utils::BlockStateId; 3]]>,
1393            > = std::sync::OnceLock::new();
1394            ORE_VEIN_STATES.get_or_init(|| Box::from([]))
1395        };
1396    }
1397}
1398impl NetherNoises {
1399    /// Apply this dimension's surface rule at the current context position.
1400    #[allow(
1401        clippy::collapsible_if,
1402        clippy::needless_return,
1403        clippy::erasing_op,
1404        unused_comparisons
1405    )]
1406    fn apply_surface_rule_impl(
1407        ctx: &mut steel_worldgen::surface::SurfaceRuleContext<'_>,
1408    ) -> Option<steel_utils::BlockStateId> {
1409        if ctx
1410            .system
1411            .vertical_gradient(0usize, ctx.block_x, ctx.block_y, ctx.block_z, 0i32, 5i32)
1412        {
1413            return Some(ctx.block_state(0usize));
1414        }
1415        if !(ctx
1416            .system
1417            .vertical_gradient(
1418                1usize,
1419                ctx.block_x,
1420                ctx.block_y,
1421                ctx.block_z,
1422                122i32,
1423                127i32,
1424            ))
1425        {
1426            return Some(ctx.block_state(0usize));
1427        }
1428        if ctx.block_y >= 122i32 + ctx.surface_depth * 0i32 {
1429            return Some(ctx.block_state(1usize));
1430        }
1431        if ctx
1432            .known_biome_id()
1433            .is_some_and(|biome_id| {
1434                biome_id
1435                    == steel_registry::RegistryEntry::id(
1436                        &*steel_registry::vanilla_biomes::BASALT_DELTAS,
1437                    ) as u16
1438            })
1439        {
1440            if ctx.stone_depth_below <= 1 + 0i32 + ctx.surface_depth {
1441                return Some(ctx.block_state(2usize));
1442            }
1443            if ctx.stone_depth_above <= 1 + 0i32 + ctx.surface_depth {
1444                if {
1445                    let v = ctx.condition_noise(0usize);
1446                    v >= -0.012f64
1447                        && v
1448                            <= 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f64
1449                } {
1450                    if ctx.block_y + ctx.stone_depth_above
1451                        >= 30i32 + ctx.surface_depth * 0i32
1452                    {
1453                        if !(ctx.block_y + ctx.stone_depth_above
1454                            >= 35i32 + ctx.surface_depth * 0i32)
1455                        {
1456                            return Some(ctx.block_state(3usize));
1457                        }
1458                    }
1459                }
1460                if {
1461                    let v = ctx.condition_noise(1usize);
1462                    v >= 0f64
1463                        && v
1464                            <= 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f64
1465                } {
1466                    return Some(ctx.block_state(2usize));
1467                }
1468                return Some(ctx.block_state(4usize));
1469            }
1470        }
1471        if ctx
1472            .known_biome_id()
1473            .is_some_and(|biome_id| {
1474                biome_id
1475                    == steel_registry::RegistryEntry::id(
1476                        &*steel_registry::vanilla_biomes::SOUL_SAND_VALLEY,
1477                    ) as u16
1478            })
1479        {
1480            if ctx.stone_depth_below <= 1 + 0i32 + ctx.surface_depth {
1481                if {
1482                    let v = ctx.condition_noise(1usize);
1483                    v >= 0f64
1484                        && v
1485                            <= 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f64
1486                } {
1487                    return Some(ctx.block_state(5usize));
1488                }
1489                return Some(ctx.block_state(6usize));
1490            }
1491            if ctx.stone_depth_above <= 1 + 0i32 + ctx.surface_depth {
1492                if {
1493                    let v = ctx.condition_noise(0usize);
1494                    v >= -0.012f64
1495                        && v
1496                            <= 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f64
1497                } {
1498                    if ctx.block_y + ctx.stone_depth_above
1499                        >= 30i32 + ctx.surface_depth * 0i32
1500                    {
1501                        if !(ctx.block_y + ctx.stone_depth_above
1502                            >= 35i32 + ctx.surface_depth * 0i32)
1503                        {
1504                            return Some(ctx.block_state(3usize));
1505                        }
1506                    }
1507                }
1508                if {
1509                    let v = ctx.condition_noise(1usize);
1510                    v >= 0f64
1511                        && v
1512                            <= 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f64
1513                } {
1514                    return Some(ctx.block_state(5usize));
1515                }
1516                return Some(ctx.block_state(6usize));
1517            }
1518        }
1519        if ctx.stone_depth_above <= 1 + 0i32 {
1520            if !(ctx.block_y >= 32i32 + ctx.surface_depth * 0i32) {
1521                if ctx.surface_depth <= 0 {
1522                    return Some(ctx.block_state(7usize));
1523                }
1524            }
1525            if ctx
1526                .known_biome_id()
1527                .is_some_and(|biome_id| {
1528                    biome_id
1529                        == steel_registry::RegistryEntry::id(
1530                            &*steel_registry::vanilla_biomes::WARPED_FOREST,
1531                        ) as u16
1532                })
1533            {
1534                if !({
1535                    let v = ctx.condition_noise(2usize);
1536                    v >= 0.54f64
1537                        && v
1538                            <= 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f64
1539                }) {
1540                    if ctx.block_y >= 31i32 + ctx.surface_depth * 0i32 {
1541                        if {
1542                            let v = ctx.condition_noise(3usize);
1543                            v >= 1.17f64
1544                                && v
1545                                    <= 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f64
1546                        } {
1547                            return Some(ctx.block_state(8usize));
1548                        }
1549                        return Some(ctx.block_state(9usize));
1550                    }
1551                }
1552            }
1553            if ctx
1554                .known_biome_id()
1555                .is_some_and(|biome_id| {
1556                    biome_id
1557                        == steel_registry::RegistryEntry::id(
1558                            &*steel_registry::vanilla_biomes::CRIMSON_FOREST,
1559                        ) as u16
1560                })
1561            {
1562                if !({
1563                    let v = ctx.condition_noise(2usize);
1564                    v >= 0.54f64
1565                        && v
1566                            <= 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f64
1567                }) {
1568                    if ctx.block_y >= 31i32 + ctx.surface_depth * 0i32 {
1569                        if {
1570                            let v = ctx.condition_noise(3usize);
1571                            v >= 1.17f64
1572                                && v
1573                                    <= 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f64
1574                        } {
1575                            return Some(ctx.block_state(10usize));
1576                        }
1577                        return Some(ctx.block_state(11usize));
1578                    }
1579                }
1580            }
1581        }
1582        if ctx
1583            .known_biome_id()
1584            .is_some_and(|biome_id| {
1585                biome_id
1586                    == steel_registry::RegistryEntry::id(
1587                        &*steel_registry::vanilla_biomes::NETHER_WASTES,
1588                    ) as u16
1589            })
1590        {
1591            if ctx.stone_depth_above <= 1 + 0i32 + ctx.surface_depth {
1592                if {
1593                    let v = ctx.condition_noise(4usize);
1594                    v >= -0.012f64
1595                        && v
1596                            <= 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f64
1597                } {
1598                    if !(ctx.surface_depth <= 0) {
1599                        if ctx.block_y + ctx.stone_depth_above
1600                            >= 30i32 + ctx.surface_depth * 0i32
1601                        {
1602                            if !(ctx.block_y + ctx.stone_depth_above
1603                                >= 35i32 + ctx.surface_depth * 0i32)
1604                            {
1605                                return Some(ctx.block_state(5usize));
1606                            }
1607                        }
1608                    }
1609                    return Some(ctx.block_state(1usize));
1610                }
1611            }
1612            if ctx.stone_depth_above <= 1 + 0i32 {
1613                if ctx.block_y >= 31i32 + ctx.surface_depth * 0i32 {
1614                    if !(ctx.block_y + ctx.stone_depth_above
1615                        >= 35i32 + ctx.surface_depth * 0i32)
1616                    {
1617                        if {
1618                            let v = ctx.condition_noise(5usize);
1619                            v >= -0.012f64
1620                                && v
1621                                    <= 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f64
1622                        } {
1623                            if ctx.block_y >= 32i32 + ctx.surface_depth * 0i32 {
1624                                return Some(ctx.block_state(3usize));
1625                            }
1626                            if !(ctx.surface_depth <= 0) {
1627                                return Some(ctx.block_state(3usize));
1628                            }
1629                        }
1630                    }
1631                }
1632            }
1633        }
1634        return Some(ctx.block_state(1usize));
1635        None
1636    }
1637}