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};
15pub struct EndNoises {
19 pub blended_noise: steel_worldgen::noise::BlendedNoise,
20 pub end_islands: steel_worldgen::noise::EndIslands,
21}
22impl EndNoises {
23 pub fn create(
25 seed: u64,
26 splitter: &RandomSplitter,
27 params: &rustc_hash::FxHashMap<String, steel_worldgen::density::NoiseParameters>,
28 ) -> Self {
29 let _ = seed;
30 Self {
31 blended_noise: {
32 let mut rng = steel_worldgen::random::RandomSource::Legacy(
33 steel_worldgen::random::legacy_random::LegacyRandom::from_seed(seed),
34 );
35 steel_worldgen::noise::BlendedNoise::new(
36 &mut rng,
37 0.25,
38 0.25,
39 80.0,
40 160.0,
41 4.0,
42 )
43 },
44 end_islands: steel_worldgen::noise::EndIslands::new(seed),
45 }
46 }
47}
48#[derive(Clone)]
57pub struct EndColumnCache {
58 pub x: i32,
60 pub z: i32,
62 qx: i32,
64 qz: i32,
66 valid: bool,
67 grid_first_quart_x: i32,
68 grid_first_quart_z: i32,
69 has_grid: bool,
70 pub df_end__islands: f32,
71 pub router_continentalness: f32,
72 pub router_depth: f32,
73 pub router_erosion: f32,
74 pub router_ridges: f32,
75 pub router_temperature: f32,
76 pub router_vegetation: f32,
77 grid_df_end__islands: [f32; 9],
78 grid_router_continentalness: [f32; 9],
79 grid_router_depth: [f32; 9],
80 grid_router_erosion: [f32; 9],
81 grid_router_ridges: [f32; 9],
82 grid_router_temperature: [f32; 9],
83 grid_router_vegetation: [f32; 9],
84}
85impl EndColumnCache {
86 const GRID_SIDE: i32 = 3;
88 #[must_use]
90 pub fn new() -> Self {
91 Self {
92 x: 0,
93 z: 0,
94 qx: i32::MIN,
95 qz: i32::MIN,
96 valid: false,
97 grid_first_quart_x: 0,
98 grid_first_quart_z: 0,
99 has_grid: false,
100 df_end__islands: 0.0,
101 router_continentalness: 0.0,
102 router_depth: 0.0,
103 router_erosion: 0.0,
104 router_ridges: 0.0,
105 router_temperature: 0.0,
106 router_vegetation: 0.0,
107 grid_df_end__islands: [0.0; 9],
108 grid_router_continentalness: [0.0; 9],
109 grid_router_depth: [0.0; 9],
110 grid_router_erosion: [0.0; 9],
111 grid_router_ridges: [0.0; 9],
112 grid_router_temperature: [0.0; 9],
113 grid_router_vegetation: [0.0; 9],
114 }
115 }
116 pub fn init_grid(
122 &mut self,
123 chunk_block_x: i32,
124 chunk_block_z: i32,
125 noises: &EndNoises,
126 ) {
127 self.grid_first_quart_x = chunk_block_x >> 2;
128 self.grid_first_quart_z = chunk_block_z >> 2;
129 self.has_grid = true;
130 self.valid = false;
131 for rel_z in 0..Self::GRID_SIDE {
132 for rel_x in 0..Self::GRID_SIDE {
133 let x = ((self.grid_first_quart_x + rel_x) << 2) as f64;
134 let z = ((self.grid_first_quart_z + rel_z) << 2) as f64;
135 let idx = (rel_z * Self::GRID_SIDE + rel_x) as usize;
136 let val = compute_end__islands(noises, &*self, x, z);
137 self.df_end__islands = val;
138 self.grid_df_end__islands[idx] = self.df_end__islands;
139 let val = compute_router_continentalness(noises, &*self, x, z);
140 self.router_continentalness = val;
141 let val = compute_router_depth(noises, &*self, x, z);
142 self.router_depth = val;
143 let val = compute_router_erosion(noises, &*self, x, z);
144 self.router_erosion = val;
145 let val = compute_router_ridges(noises, &*self, x, z);
146 self.router_ridges = val;
147 let val = compute_router_temperature(noises, &*self, x, z);
148 self.router_temperature = val;
149 let val = compute_router_vegetation(noises, &*self, x, z);
150 self.router_vegetation = val;
151 self.grid_router_continentalness[idx] = self.router_continentalness;
152 self.grid_router_depth[idx] = self.router_depth;
153 self.grid_router_erosion[idx] = self.router_erosion;
154 self.grid_router_ridges[idx] = self.router_ridges;
155 self.grid_router_temperature[idx] = self.router_temperature;
156 self.grid_router_vegetation[idx] = self.router_vegetation;
157 }
158 }
159 }
160 pub fn ensure(&mut self, x: i32, z: i32, noises: &EndNoises) {
165 self.x = x;
166 self.z = z;
167 let quart_x = x >> 2;
168 let quart_z = z >> 2;
169 if self.has_grid {
170 let rel_x = quart_x - self.grid_first_quart_x;
171 let rel_z = quart_z - self.grid_first_quart_z;
172 if x & 3 == 0 && z & 3 == 0 && rel_x >= 0 && rel_z >= 0
173 && rel_x < Self::GRID_SIDE && rel_z < Self::GRID_SIDE
174 {
175 let eval_x = quart_x << 2;
176 let eval_z = quart_z << 2;
177 if self.valid && self.qx == eval_x && self.qz == eval_z {
178 return;
179 }
180 let idx = (rel_z * Self::GRID_SIDE + rel_x) as usize;
181 self.df_end__islands = self.grid_df_end__islands[idx];
182 self.router_continentalness = self.grid_router_continentalness[idx];
183 self.router_depth = self.grid_router_depth[idx];
184 self.router_erosion = self.grid_router_erosion[idx];
185 self.router_ridges = self.grid_router_ridges[idx];
186 self.router_temperature = self.grid_router_temperature[idx];
187 self.router_vegetation = self.grid_router_vegetation[idx];
188 self.qx = eval_x;
189 self.qz = eval_z;
190 self.valid = true;
191 return;
192 }
193 if self.valid && self.qx == x && self.qz == z {
194 return;
195 }
196 self.qx = x;
197 self.qz = z;
198 let x = x as f64;
199 let z = z as f64;
200 let val = compute_end__islands(noises, &*self, x, z);
201 self.df_end__islands = val;
202 let val = compute_router_continentalness(noises, &*self, x, z);
203 self.router_continentalness = val;
204 let val = compute_router_depth(noises, &*self, x, z);
205 self.router_depth = val;
206 let val = compute_router_erosion(noises, &*self, x, z);
207 self.router_erosion = val;
208 let val = compute_router_ridges(noises, &*self, x, z);
209 self.router_ridges = val;
210 let val = compute_router_temperature(noises, &*self, x, z);
211 self.router_temperature = val;
212 let val = compute_router_vegetation(noises, &*self, x, z);
213 self.router_vegetation = val;
214 self.valid = true;
215 return;
216 }
217 if self.valid && self.qx == x && self.qz == z {
218 return;
219 }
220 self.qx = x;
221 self.qz = z;
222 let x = x as f64;
223 let z = z as f64;
224 let val = compute_end__islands(noises, &*self, x, z);
225 self.df_end__islands = val;
226 let val = compute_router_continentalness(noises, &*self, x, z);
227 self.router_continentalness = val;
228 let val = compute_router_depth(noises, &*self, x, z);
229 self.router_depth = val;
230 let val = compute_router_erosion(noises, &*self, x, z);
231 self.router_erosion = val;
232 let val = compute_router_ridges(noises, &*self, x, z);
233 self.router_ridges = val;
234 let val = compute_router_temperature(noises, &*self, x, z);
235 self.router_temperature = val;
236 let val = compute_router_vegetation(noises, &*self, x, z);
237 self.router_vegetation = val;
238 self.valid = true;
239 }
240}
241#[inline]
243fn compute_end__base_3d_noise(
244 noises: &EndNoises,
245 cache: &EndColumnCache,
246 x: f64,
247 y: f64,
248 z: f64,
249) -> f32 {
250 (noises.blended_noise.compute(x, y, z) as f32) as f32
251}
252#[inline]
254fn compute_end__islands(
255 noises: &EndNoises,
256 cache: &EndColumnCache,
257 x: f64,
258 z: f64,
259) -> f32 {
260 ({
261 let __sc_a = ({
262 let y = 0f64;
263 ((((((((((((100.0) as f32)
264 - ((((0f32 - x as f32).powi(2) + (0f32 - y as f32).powi(2)
265 + (0f32 - z as f32).powi(2))
266 .sqrt()) as f32))) as f32)
267 .clamp(-100.0, 80.0)) as f32) - ((8.0) as f32))) as f32)
268 * ((0.0078125) as f32))) as f32
269 }) as f32;
270 if __sc_a >= 80.0 {
271 __sc_a
272 } else {
273 let __sc_b = (noises.end_islands.sample(x, 0.0, z) as f32) as f32;
274 if __sc_a > __sc_b { __sc_a } else { __sc_b }
275 }
276 }) as f32
277}
278#[inline]
280fn compute_end__sloped_cheese(
281 noises: &EndNoises,
282 cache: &EndColumnCache,
283 x: f64,
284 y: f64,
285 z: f64,
286) -> f32 {
287 ((((cache.df_end__islands) as f32)
288 + ((compute_end__base_3d_noise(noises, cache, x, y, z)) as f32))) as f32
289}
290#[inline]
291fn compute_end__base_3d_noise_simd<const N: usize>(
292 noises: &EndNoises,
293 cache: &EndColumnCache,
294 x: f64,
295 ys: Simd<f64, N>,
296 z: f64,
297) -> Simd<f32, N> {
298 {
299 let __ys_arr = ys.to_array();
300 let mut __values = [0.0_f32; N];
301 for lane in 0..N {
302 #[allow(clippy::cast_possible_truncation)]
303 let y = __ys_arr[lane];
304 __values[lane] = (noises.blended_noise.compute(x, y, z) as f32) as f32;
305 }
306 Simd::from_array(__values)
307 }
308}
309#[inline]
310fn compute_end__sloped_cheese_simd<const N: usize>(
311 noises: &EndNoises,
312 cache: &EndColumnCache,
313 x: f64,
314 ys: Simd<f64, N>,
315 z: f64,
316) -> Simd<f32, N> {
317 ((Simd::<f32, N>::splat(cache.df_end__islands))
318 + (compute_end__base_3d_noise_simd::<N>(noises, cache, x, ys, z)))
319}
320pub const AQUIFER_NEEDS_COLUMN_CACHE: bool = true;
322#[inline]
323fn compute_router_continentalness(
324 noises: &EndNoises,
325 cache: &EndColumnCache,
326 x: f64,
327 z: f64,
328) -> f32 {
329 (0.0) as f32
330}
331#[inline]
333pub fn router_continentalness(
334 noises: &EndNoises,
335 cache: &EndColumnCache,
336 x: f64,
337 y: f64,
338 z: f64,
339) -> f32 {
340 cache.router_continentalness
341}
342#[inline]
343fn compute_router_depth(
344 noises: &EndNoises,
345 cache: &EndColumnCache,
346 x: f64,
347 z: f64,
348) -> f32 {
349 (0.0) as f32
350}
351#[inline]
353pub fn router_depth(
354 noises: &EndNoises,
355 cache: &EndColumnCache,
356 x: f64,
357 y: f64,
358 z: f64,
359) -> f32 {
360 cache.router_depth
361}
362#[inline]
363fn compute_router_erosion(
364 noises: &EndNoises,
365 cache: &EndColumnCache,
366 x: f64,
367 z: f64,
368) -> f32 {
369 (cache.df_end__islands) as f32
370}
371#[inline]
373pub fn router_erosion(
374 noises: &EndNoises,
375 cache: &EndColumnCache,
376 x: f64,
377 y: f64,
378 z: f64,
379) -> f32 {
380 cache.router_erosion
381}
382#[inline]
384pub fn router_final_density(
385 noises: &EndNoises,
386 cache: &EndColumnCache,
387 x: f64,
388 y: f64,
389 z: f64,
390) -> f32 {
391 let x = cache.x as f64;
392 let z = cache.z as f64;
393 (((({
394 let c = ((((((({
395 let __lerp_alpha = ({
396 let __coordinate = (y as i32).clamp(4, 32) - 4;
397 0.0 + __coordinate as f32 * ((1.0 - 0.0) / (32 - 4) as f32)
398 }) as f32;
399 if __lerp_alpha == 0.0 {
400 (-0.234375) as f32
401 } else if __lerp_alpha == 1.0 {
402 ({
403 let __lerp_alpha = ({
404 let __coordinate = (y as i32).clamp(56, 312) - 56;
405 1.0 + __coordinate as f32 * ((0.0 - 1.0) / (312 - 56) as f32)
406 }) as f32;
407 if __lerp_alpha == 0.0 {
408 (-23.4375) as f32
409 } else if __lerp_alpha == 1.0 {
410 (compute_end__sloped_cheese(noises, cache, x, y, z)) as f32
411 } else {
412 let __lerp_first = (-23.4375) as f32;
413 __lerp_first
414 + __lerp_alpha
415 * (((compute_end__sloped_cheese(noises, cache, x, y, z))
416 as f32) - __lerp_first)
417 }
418 }) as f32
419 } else {
420 let __lerp_first = (-0.234375) as f32;
421 __lerp_first
422 + __lerp_alpha
423 * ((({
424 let __lerp_alpha = ({
425 let __coordinate = (y as i32).clamp(56, 312) - 56;
426 1.0
427 + __coordinate as f32 * ((0.0 - 1.0) / (312 - 56) as f32)
428 }) as f32;
429 if __lerp_alpha == 0.0 {
430 (-23.4375) as f32
431 } else if __lerp_alpha == 1.0 {
432 (compute_end__sloped_cheese(noises, cache, x, y, z)) as f32
433 } else {
434 let __lerp_first = (-23.4375) as f32;
435 __lerp_first
436 + __lerp_alpha
437 * (((compute_end__sloped_cheese(noises, cache, x, y, z))
438 as f32) - __lerp_first)
439 }
440 }) as f32) - __lerp_first)
441 }
442 }) as f32) as f32) * ((0.64) as f32))) as f32) as f32)
443 .clamp(-1.0, 1.0);
444 c / 2.0 - c * c * c / 24.0
445 }) as f32) + ((0.0) as f32))) as f32
446}
447#[inline]
448fn compute_router_ridges(
449 noises: &EndNoises,
450 cache: &EndColumnCache,
451 x: f64,
452 z: f64,
453) -> f32 {
454 (0.0) as f32
455}
456#[inline]
458pub fn router_ridges(
459 noises: &EndNoises,
460 cache: &EndColumnCache,
461 x: f64,
462 y: f64,
463 z: f64,
464) -> f32 {
465 cache.router_ridges
466}
467#[inline]
468fn compute_router_temperature(
469 noises: &EndNoises,
470 cache: &EndColumnCache,
471 x: f64,
472 z: f64,
473) -> f32 {
474 (0.0) as f32
475}
476#[inline]
478pub fn router_temperature(
479 noises: &EndNoises,
480 cache: &EndColumnCache,
481 x: f64,
482 y: f64,
483 z: f64,
484) -> f32 {
485 cache.router_temperature
486}
487#[inline]
488fn compute_router_vegetation(
489 noises: &EndNoises,
490 cache: &EndColumnCache,
491 x: f64,
492 z: f64,
493) -> f32 {
494 (0.0) as f32
495}
496#[inline]
498pub fn router_vegetation(
499 noises: &EndNoises,
500 cache: &EndColumnCache,
501 x: f64,
502 y: f64,
503 z: f64,
504) -> f32 {
505 cache.router_vegetation
506}
507pub const INTERPOLATED_COUNT: usize = 1;
510pub const VEIN_INTERP_ENABLED: bool = false;
512pub const FINAL_DENSITY_NONPOSITIVE_CHANNELS: Option<&[usize]> = Some(&[0]);
515#[expect(
519 unused_variables,
520 reason = "generated function has a fixed signature; blended_noise_value is unused in dimensions without blended noise"
521)]
522pub fn fill_cell_corner_densities(
523 noises: &EndNoises,
524 cache: &EndColumnCache,
525 x: i32,
526 y: i32,
527 z: i32,
528 blended_noise_value: f32,
529 out: &mut [f32],
530) {
531 let x = cache.x as f64;
532 let z = cache.z as f64;
533 let y = y as f64;
534 out[0] = ((((({
535 let __lerp_alpha = ({
536 let __coordinate = (y as i32).clamp(4, 32) - 4;
537 0.0 + __coordinate as f32 * ((1.0 - 0.0) / (32 - 4) as f32)
538 }) as f32;
539 if __lerp_alpha == 0.0 {
540 (-0.234375) as f32
541 } else if __lerp_alpha == 1.0 {
542 ({
543 let __lerp_alpha = ({
544 let __coordinate = (y as i32).clamp(56, 312) - 56;
545 1.0 + __coordinate as f32 * ((0.0 - 1.0) / (312 - 56) as f32)
546 }) as f32;
547 if __lerp_alpha == 0.0 {
548 (-23.4375) as f32
549 } else if __lerp_alpha == 1.0 {
550 (((((cache.df_end__islands) as f32)
551 + (((blended_noise_value as f32) as f32) as f32))) as f32) as f32
552 } else {
553 let __lerp_first = (-23.4375) as f32;
554 __lerp_first
555 + __lerp_alpha
556 * (((((((cache.df_end__islands) as f32)
557 + (((blended_noise_value as f32) as f32) as f32))) as f32)
558 as f32) - __lerp_first)
559 }
560 }) as f32
561 } else {
562 let __lerp_first = (-0.234375) as f32;
563 __lerp_first
564 + __lerp_alpha
565 * ((({
566 let __lerp_alpha = ({
567 let __coordinate = (y as i32).clamp(56, 312) - 56;
568 1.0 + __coordinate as f32 * ((0.0 - 1.0) / (312 - 56) as f32)
569 }) as f32;
570 if __lerp_alpha == 0.0 {
571 (-23.4375) as f32
572 } else if __lerp_alpha == 1.0 {
573 (((((cache.df_end__islands) as f32)
574 + (((blended_noise_value as f32) as f32) as f32))) as f32)
575 as f32
576 } else {
577 let __lerp_first = (-23.4375) as f32;
578 __lerp_first
579 + __lerp_alpha
580 * (((((((cache.df_end__islands) as f32)
581 + (((blended_noise_value as f32) as f32) as f32))) as f32)
582 as f32) - __lerp_first)
583 }
584 }) as f32) - __lerp_first)
585 }
586 }) as f32) as f32) * ((0.64) as f32))) as f32;
587}
588#[inline]
591pub fn fill_cell_corner_densities_y_simd<const N: usize>(
592 noises: &EndNoises,
593 cache: &EndColumnCache,
594 x: i32,
595 ys: [i32; N],
596 z: i32,
597 blended_noise_values: [f32; N],
598 out: &mut [f32],
599) {
600 let x = cache.x as f64;
601 let z = cache.z as f64;
602 let ys = Simd::from_array(ys.map(f64::from));
603 let blended_noise_value_v = Simd::from_array(blended_noise_values);
604 let __values_simd_0 = ((({
605 let __lerp_alpha = {
606 let __coordinate = ys
607 .cast::<i32>()
608 .simd_max(Simd::splat(4))
609 .simd_min(Simd::splat(32)) - Simd::splat(4);
610 Simd::<f32, N>::splat(0.0)
611 + __coordinate.cast::<f32>()
612 * Simd::<f32, N>::splat((1.0 - 0.0) / (32 - 4) as f32)
613 };
614 let __zero = __lerp_alpha.simd_eq(Simd::<f32, N>::splat(0.0));
615 let __one = __lerp_alpha.simd_eq(Simd::<f32, N>::splat(1.0));
616 if __zero.all() {
617 Simd::<f32, N>::splat(-0.234375)
618 } else if __one.all() {
619 {
620 let __lerp_alpha = {
621 let __coordinate = ys
622 .cast::<i32>()
623 .simd_max(Simd::splat(56))
624 .simd_min(Simd::splat(312)) - Simd::splat(56);
625 Simd::<f32, N>::splat(1.0)
626 + __coordinate.cast::<f32>()
627 * Simd::<f32, N>::splat((0.0 - 1.0) / (312 - 56) as f32)
628 };
629 let __zero = __lerp_alpha.simd_eq(Simd::<f32, N>::splat(0.0));
630 let __one = __lerp_alpha.simd_eq(Simd::<f32, N>::splat(1.0));
631 if __zero.all() {
632 Simd::<f32, N>::splat(-23.4375)
633 } else if __one.all() {
634 ((Simd::<f32, N>::splat(cache.df_end__islands))
635 + (blended_noise_value_v))
636 } else {
637 let __lerp_first = Simd::<f32, N>::splat(-23.4375);
638 let __lerp_second = ((Simd::<f32, N>::splat(cache.df_end__islands))
639 + (blended_noise_value_v));
640 let __lerp_value = __lerp_first
641 + __lerp_alpha * (__lerp_second - __lerp_first);
642 __zero
643 .select(__lerp_first, __one.select(__lerp_second, __lerp_value))
644 }
645 }
646 } else {
647 let __lerp_first = Simd::<f32, N>::splat(-0.234375);
648 let __lerp_second = {
649 let __lerp_alpha = {
650 let __coordinate = ys
651 .cast::<i32>()
652 .simd_max(Simd::splat(56))
653 .simd_min(Simd::splat(312)) - Simd::splat(56);
654 Simd::<f32, N>::splat(1.0)
655 + __coordinate.cast::<f32>()
656 * Simd::<f32, N>::splat((0.0 - 1.0) / (312 - 56) as f32)
657 };
658 let __zero = __lerp_alpha.simd_eq(Simd::<f32, N>::splat(0.0));
659 let __one = __lerp_alpha.simd_eq(Simd::<f32, N>::splat(1.0));
660 if __zero.all() {
661 Simd::<f32, N>::splat(-23.4375)
662 } else if __one.all() {
663 ((Simd::<f32, N>::splat(cache.df_end__islands))
664 + (blended_noise_value_v))
665 } else {
666 let __lerp_first = Simd::<f32, N>::splat(-23.4375);
667 let __lerp_second = ((Simd::<f32, N>::splat(cache.df_end__islands))
668 + (blended_noise_value_v));
669 let __lerp_value = __lerp_first
670 + __lerp_alpha * (__lerp_second - __lerp_first);
671 __zero
672 .select(__lerp_first, __one.select(__lerp_second, __lerp_value))
673 }
674 };
675 let __lerp_value = __lerp_first
676 + __lerp_alpha * (__lerp_second - __lerp_first);
677 __zero.select(__lerp_first, __one.select(__lerp_second, __lerp_value))
678 }
679 }) * (Simd::<f32, N>::splat(0.64))))
680 .to_array();
681 for lane in 0..N {
682 out[lane * INTERPOLATED_COUNT + 0] = __values_simd_0[lane];
683 }
684}
685#[expect(
687 unused_variables,
688 reason = "generated function has a fixed signature; not all parameters are used in every dimension"
689)]
690pub fn combine_interpolated(
691 noises: &EndNoises,
692 cache: &EndColumnCache,
693 interpolated: &[f32],
694 _x: i32,
695 y: i32,
696 _z: i32,
697) -> f32 {
698 let x = cache.x as f64;
699 let z = cache.z as f64;
700 let y = y as f64;
701 (((({
702 let c = ((interpolated[0]) as f32).clamp(-1.0, 1.0);
703 c / 2.0 - c * c * c / 24.0
704 }) as f32) + ((0.0) as f32))) as f32
705}
706#[expect(
708 unused_variables,
709 reason = "generated function has a fixed signature; not all parameters are used in every dimension"
710)]
711pub fn combine_vein_toggle(
712 noises: &EndNoises,
713 cache: &EndColumnCache,
714 interpolated: &[f32],
715 _x: i32,
716 y: i32,
717 _z: i32,
718) -> f32 {
719 let x = cache.x as f64;
720 let z = cache.z as f64;
721 let y = y as f64;
722 0.0
723}
724#[expect(
726 unused_variables,
727 reason = "generated function has a fixed signature; not all parameters are used in every dimension"
728)]
729pub fn combine_vein_ridged(
730 noises: &EndNoises,
731 cache: &EndColumnCache,
732 interpolated: &[f32],
733 _x: i32,
734 y: i32,
735 _z: i32,
736) -> f32 {
737 let x = cache.x as f64;
738 let z = cache.z as f64;
739 let y = y as f64;
740 0.0
741}
742pub struct EndNoiseSettings;
744impl EndNoiseSettings {
745 pub const MIN_Y: i32 = 0i32;
747 pub const HEIGHT: i32 = 128i32;
749 pub const SEA_LEVEL: i32 = 0i32;
751 pub const CELL_WIDTH: i32 = 8i32;
753 pub const CELL_HEIGHT: i32 = 4i32;
755 pub const AQUIFERS_ENABLED: bool = false;
757 pub const ORE_VEINS_ENABLED: bool = false;
759 pub const MATERIAL_ORE_VEINS_ENABLED: bool = false;
761 pub const LEGACY_RANDOM_SOURCE: bool = true;
763 #[inline]
765 pub fn default_block_id() -> steel_utils::BlockStateId {
766 steel_registry::REGISTRY
767 .blocks
768 .get_default_state_id(&steel_registry::vanilla_blocks::END_STONE)
769 }
770 #[inline]
772 pub fn default_fluid_id() -> steel_utils::BlockStateId {
773 steel_registry::REGISTRY
774 .blocks
775 .get_default_state_id(&steel_registry::vanilla_blocks::AIR)
776 }
777}
778impl steel_worldgen::density::NoiseSettings for EndNoiseSettings {
779 const MIN_Y: i32 = 0i32;
780 const HEIGHT: i32 = 128i32;
781 const SEA_LEVEL: i32 = 0i32;
782 const CELL_WIDTH: i32 = 8i32;
783 const CELL_HEIGHT: i32 = 4i32;
784 const AQUIFERS_ENABLED: bool = false;
785 const ORE_VEINS_ENABLED: bool = false;
786 const MATERIAL_ORE_VEINS_ENABLED: bool = false;
787 const LEGACY_RANDOM_SOURCE: bool = true;
788 #[inline]
789 fn default_block_id() -> steel_utils::BlockStateId {
790 EndNoiseSettings::default_block_id()
791 }
792 #[inline]
793 fn default_fluid_id() -> steel_utils::BlockStateId {
794 EndNoiseSettings::default_fluid_id()
795 }
796}
797impl Default for EndColumnCache {
798 fn default() -> Self {
799 Self::new()
800 }
801}
802impl steel_worldgen::density::ColumnCache for EndColumnCache {
803 type Noises = EndNoises;
804 #[inline]
805 fn ensure(&mut self, x: i32, z: i32, noises: &Self::Noises) {
806 EndColumnCache::ensure(self, x, z, noises)
807 }
808 #[inline]
809 fn init_grid(
810 &mut self,
811 chunk_block_x: i32,
812 chunk_block_z: i32,
813 noises: &Self::Noises,
814 ) {
815 EndColumnCache::init_grid(self, chunk_block_x, chunk_block_z, noises)
816 }
817}
818impl steel_worldgen::density::DimensionNoises for EndNoises {
819 type ColumnCache = EndColumnCache;
820 type Settings = EndNoiseSettings;
821 fn create(
822 seed: u64,
823 splitter: &steel_utils::random::RandomSplitter,
824 params: &rustc_hash::FxHashMap<String, steel_worldgen::density::NoiseParameters>,
825 ) -> Self {
826 EndNoises::create(seed, splitter, params)
827 }
828 #[inline]
829 fn router_final_density(
830 &self,
831 cache: &mut Self::ColumnCache,
832 x: i32,
833 y: i32,
834 z: i32,
835 ) -> f32 {
836 router_final_density(self, cache, x as f64, y as f64, z as f64)
837 }
838 #[inline]
839 fn router_depth(
840 &self,
841 cache: &mut Self::ColumnCache,
842 x: i32,
843 y: i32,
844 z: i32,
845 ) -> f32 {
846 router_depth(self, cache, x as f64, y as f64, z as f64)
847 }
848 #[inline]
849 fn aquifer_needs_column_cache() -> bool {
850 AQUIFER_NEEDS_COLUMN_CACHE
851 }
852 #[inline]
853 fn router_barrier(
854 &self,
855 cache: &mut Self::ColumnCache,
856 x: i32,
857 y: i32,
858 z: i32,
859 ) -> f32 {
860 0.0
861 }
862 #[inline]
863 fn router_fluid_level_floodedness(
864 &self,
865 cache: &mut Self::ColumnCache,
866 x: i32,
867 y: i32,
868 z: i32,
869 ) -> f32 {
870 0.0
871 }
872 #[inline]
873 fn router_fluid_level_spread(
874 &self,
875 cache: &mut Self::ColumnCache,
876 x: i32,
877 y: i32,
878 z: i32,
879 ) -> f32 {
880 0.0
881 }
882 #[inline]
883 fn router_lava(&self, cache: &mut Self::ColumnCache, x: i32, y: i32, z: i32) -> f32 {
884 0.0
885 }
886 #[inline]
887 fn router_vein_toggle(
888 &self,
889 cache: &mut Self::ColumnCache,
890 x: i32,
891 y: i32,
892 z: i32,
893 ) -> f32 {
894 0.0
895 }
896 #[inline]
897 fn router_vein_ridged(
898 &self,
899 cache: &mut Self::ColumnCache,
900 x: i32,
901 y: i32,
902 z: i32,
903 ) -> f32 {
904 0.0
905 }
906 #[inline]
907 fn router_vein_gap(
908 &self,
909 cache: &mut Self::ColumnCache,
910 x: i32,
911 y: i32,
912 z: i32,
913 ) -> f32 {
914 0.0
915 }
916 #[inline]
917 fn router_preliminary_surface_level(
918 &self,
919 cache: &mut Self::ColumnCache,
920 x: i32,
921 y: i32,
922 z: i32,
923 ) -> f32 {
924 0.0
925 }
926 #[inline]
927 fn router_erosion(
928 &self,
929 cache: &mut Self::ColumnCache,
930 x: i32,
931 y: i32,
932 z: i32,
933 ) -> f32 {
934 router_erosion(self, cache, x as f64, y as f64, z as f64)
935 }
936 #[inline]
937 fn router_continentalness(
938 &self,
939 cache: &mut Self::ColumnCache,
940 x: i32,
941 y: i32,
942 z: i32,
943 ) -> f32 {
944 router_continentalness(self, cache, x as f64, y as f64, z as f64)
945 }
946 #[inline]
947 fn router_temperature(
948 &self,
949 cache: &mut Self::ColumnCache,
950 x: i32,
951 y: i32,
952 z: i32,
953 ) -> f32 {
954 router_temperature(self, cache, x as f64, y as f64, z as f64)
955 }
956 #[inline]
957 fn router_vegetation(
958 &self,
959 cache: &mut Self::ColumnCache,
960 x: i32,
961 y: i32,
962 z: i32,
963 ) -> f32 {
964 router_vegetation(self, cache, x as f64, y as f64, z as f64)
965 }
966 #[inline]
967 fn router_ridges(
968 &self,
969 cache: &mut Self::ColumnCache,
970 x: i32,
971 y: i32,
972 z: i32,
973 ) -> f32 {
974 router_ridges(self, cache, x as f64, y as f64, z as f64)
975 }
976 #[inline]
977 fn interpolated_count() -> usize {
978 INTERPOLATED_COUNT
979 }
980 fn vein_interp_enabled() -> bool {
981 VEIN_INTERP_ENABLED
982 }
983 #[inline]
984 fn final_density_nonpositive_channels() -> Option<&'static [usize]> {
985 FINAL_DENSITY_NONPOSITIVE_CHANNELS
986 }
987 #[inline]
988 fn compute_noise_column(&self, x: i32, block_ys: &[i32], z: i32, out: &mut [f32]) {
989 self.blended_noise.compute_column(x, block_ys, z, out);
990 }
991 #[inline]
992 fn fill_cell_corner_densities(
993 &self,
994 cache: &mut Self::ColumnCache,
995 x: i32,
996 y: i32,
997 z: i32,
998 blended_noise_value: f32,
999 out: &mut [f32],
1000 ) {
1001 fill_cell_corner_densities(self, cache, x, y, z, blended_noise_value, out)
1002 }
1003 #[inline]
1004 fn fill_cell_corner_densities_y_simd<const N: usize>(
1005 &self,
1006 cache: &mut Self::ColumnCache,
1007 x: i32,
1008 ys: [i32; N],
1009 z: i32,
1010 blended_noise_values: [f32; N],
1011 out: &mut [f32],
1012 ) {
1013 fill_cell_corner_densities_y_simd::<
1014 N,
1015 >(self, cache, x, ys, z, blended_noise_values, out)
1016 }
1017 #[inline]
1018 fn combine_interpolated(
1019 &self,
1020 cache: &mut Self::ColumnCache,
1021 interpolated: &[f32],
1022 x: i32,
1023 y: i32,
1024 z: i32,
1025 ) -> f32 {
1026 combine_interpolated(self, cache, interpolated, x, y, z)
1027 }
1028 #[inline]
1029 fn combine_vein_toggle(
1030 &self,
1031 cache: &mut Self::ColumnCache,
1032 interpolated: &[f32],
1033 x: i32,
1034 y: i32,
1035 z: i32,
1036 ) -> f32 {
1037 combine_vein_toggle(self, cache, interpolated, x, y, z)
1038 }
1039 #[inline]
1040 fn combine_vein_ridged(
1041 &self,
1042 cache: &mut Self::ColumnCache,
1043 interpolated: &[f32],
1044 x: i32,
1045 y: i32,
1046 z: i32,
1047 ) -> f32 {
1048 combine_vein_ridged(self, cache, interpolated, x, y, z)
1049 }
1050 fn surface_noise_ids() -> &'static [&'static str] {
1051 &[]
1052 }
1053 fn surface_gradient_ids() -> &'static [&'static str] {
1054 &[]
1055 }
1056 fn surface_rule_block_states() -> &'static [steel_utils::BlockStateId] {
1057 {
1058 static BLOCK_STATES: std::sync::OnceLock<Box<[steel_utils::BlockStateId]>> = std::sync::OnceLock::new();
1059 BLOCK_STATES
1060 .get_or_init(|| {
1061 Box::from([
1062 steel_registry::vanilla_blocks::END_STONE.default_state(),
1063 ])
1064 })
1065 }
1066 }
1067 fn surface_rule_uses_biome() -> bool {
1068 false
1069 }
1070 fn surface_rule_biome_sets() -> &'static [Box<[u16]>] {
1071 {
1072 static BIOME_SETS: std::sync::OnceLock<Box<[Box<[u16]>]>> = std::sync::OnceLock::new();
1073 BIOME_SETS.get_or_init(|| Box::from([]))
1074 }
1075 }
1076 fn surface_rule_below_preliminary_surface() -> &'static steel_worldgen::surface_partial::PartialSurfaceRule {
1077 static RULE: steel_worldgen::surface_partial::PartialSurfaceRule = steel_worldgen::surface_partial::PartialSurfaceRule::Block(
1078 0usize,
1079 );
1080 &RULE
1081 }
1082 fn surface_rule_uses_preliminary_surface() -> bool {
1083 false
1084 }
1085 fn surface_rule_uses_surface_secondary() -> bool {
1086 false
1087 }
1088 fn surface_rule_uses_steep() -> bool {
1089 false
1090 }
1091 fn try_apply_surface_rule(
1092 ctx: &mut steel_worldgen::surface::SurfaceRuleContext<'_>,
1093 ) -> Option<steel_utils::BlockStateId> {
1094 Self::apply_surface_rule_impl(ctx)
1095 }
1096 fn material_ore_vein_value_count() -> usize {
1097 0usize
1098 }
1099 fn material_ore_vein_value_height() -> usize {
1100 0usize
1101 }
1102 fn fill_material_ore_vein_values(
1103 &self,
1104 cache: &mut Self::ColumnCache,
1105 interpolated: &[f32],
1106 x: i32,
1107 y: i32,
1108 z: i32,
1109 out: &mut [f32],
1110 ) {}
1111 fn fill_prefilled_material_ore_vein_results(
1112 &self,
1113 cache: &mut Self::ColumnCache,
1114 ore_veinifier: &steel_worldgen::noise::OreVeinifier,
1115 values: &[f32],
1116 x: i32,
1117 y: i32,
1118 z: i32,
1119 out: &mut [Option<steel_utils::BlockStateId>],
1120 ) {
1121 let ore_vein_states: &[[steel_utils::BlockStateId; 3]] = {
1122 static ORE_VEIN_STATES: std::sync::OnceLock<
1123 Box<[[steel_utils::BlockStateId; 3]]>,
1124 > = std::sync::OnceLock::new();
1125 ORE_VEIN_STATES.get_or_init(|| Box::from([]))
1126 };
1127 }
1128}
1129impl EndNoises {
1130 #[allow(
1132 clippy::collapsible_if,
1133 clippy::needless_return,
1134 clippy::erasing_op,
1135 unused_comparisons
1136 )]
1137 fn apply_surface_rule_impl(
1138 ctx: &mut steel_worldgen::surface::SurfaceRuleContext<'_>,
1139 ) -> Option<steel_utils::BlockStateId> {
1140 return Some(ctx.block_state(0usize));
1141 None
1142 }
1143}