Skip to main content

steel_worldgen/generated/vanilla_density_functions/
end.rs

1use steel_registry :: RegistryExt ; use steel_registry :: blocks :: block_state_ext :: BlockStateExt ; use std :: simd :: f64x4 ; use std :: simd :: Select ; use std :: simd :: cmp :: SimdPartialOrd ; use std :: simd :: num :: SimdFloat ; use steel_worldgen :: density :: spline_eval ; use steel_worldgen :: density :: RarityValueMapper ; use steel_math :: { clamp , map_clamped } ; use steel_worldgen :: noise :: NormalNoise ; use steel_worldgen :: random :: { PositionalRandom , RandomSplitter } ; # [doc = r" All noise generators needed by this dimension's density functions."] # [doc = r""] # [doc = r" Created at runtime from a seed via the `create` method."] pub struct EndNoises { pub blended_noise : steel_worldgen :: noise :: BlendedNoise , pub end_islands : steel_worldgen :: noise :: EndIslands , } impl EndNoises { # [doc = r" Create all noise generators from a world seed, positional splitter, and noise parameters."] pub fn create (seed : u64 , splitter : & RandomSplitter , params : & rustc_hash :: FxHashMap < String , steel_worldgen :: density :: NoiseParameters > ,) -> Self { let _ = seed ; Self { blended_noise : { let mut rng = steel_worldgen :: random :: RandomSource :: Legacy (steel_worldgen :: random :: legacy_random :: LegacyRandom :: from_seed (seed)) ; steel_worldgen :: noise :: BlendedNoise :: new (& mut rng , 0.25 , 0.25 , 80.0 , 160.0 , 4.0 ,) } , end_islands : steel_worldgen :: noise :: EndIslands :: new (seed) , } } } # [doc = r" Column-level cache for flat-cached (xz-only) density function results."] # [doc = r""] # [doc = r" Supports two modes matching vanilla's `NoiseChunk.FlatCache`:"] # [doc = r" - **Grid mode** (`init_grid()` called): Pre-computes a 2D grid of all"] # [doc = r"   in-chunk quart positions. `ensure()` does O(1) grid lookups for"] # [doc = r"   in-bounds positions, falls back to on-the-fly for out-of-bounds."] # [doc = r" - **No-grid mode** (default): Single-entry lazy cache that recomputes"] # [doc = r"   when quart-quantized coordinates change. Used by climate samplers."] # [derive (Clone)] pub struct EndColumnCache { # [doc = r" Raw x block coordinate (for non-flat router functions)."] pub x : i32 , # [doc = r" Raw z block coordinate (for non-flat router functions)."] pub z : i32 , # [doc = r" Effective x used to evaluate flat-cached values."] qx : i32 , # [doc = r" Effective z used to evaluate flat-cached values."] qz : i32 , valid : bool , grid_first_quart_x : i32 , grid_first_quart_z : i32 , has_grid : bool , pub router_barrier : f64 , pub router_continentalness : f64 , pub router_depth : f64 , pub router_erosion : f64 , pub router_fluid_level_floodedness : f64 , pub router_fluid_level_spread : f64 , pub router_lava : f64 , pub router_preliminary_surface_level : f64 , pub router_ridges : f64 , pub router_temperature : f64 , pub router_vegetation : f64 , pub router_vein_gap : f64 , pub router_vein_ridged : f64 , pub router_vein_toggle : f64 , grid_router_barrier : [f64 ; 9] , grid_router_continentalness : [f64 ; 9] , grid_router_depth : [f64 ; 9] , grid_router_erosion : [f64 ; 9] , grid_router_fluid_level_floodedness : [f64 ; 9] , grid_router_fluid_level_spread : [f64 ; 9] , grid_router_lava : [f64 ; 9] , grid_router_preliminary_surface_level : [f64 ; 9] , grid_router_ridges : [f64 ; 9] , grid_router_temperature : [f64 ; 9] , grid_router_vegetation : [f64 ; 9] , grid_router_vein_gap : [f64 ; 9] , grid_router_vein_ridged : [f64 ; 9] , grid_router_vein_toggle : [f64 ; 9] , } impl EndColumnCache { # [doc = r" Grid side length (quart positions per axis)."] const GRID_SIDE : i32 = 3 ; # [doc = r" Create a new column cache without a pre-computed grid."] # [must_use] pub fn new () -> Self { Self { x : 0 , z : 0 , qx : i32 :: MIN , qz : i32 :: MIN , valid : false , grid_first_quart_x : 0 , grid_first_quart_z : 0 , has_grid : false , router_barrier : 0.0 , router_continentalness : 0.0 , router_depth : 0.0 , router_erosion : 0.0 , router_fluid_level_floodedness : 0.0 , router_fluid_level_spread : 0.0 , router_lava : 0.0 , router_preliminary_surface_level : 0.0 , router_ridges : 0.0 , router_temperature : 0.0 , router_vegetation : 0.0 , router_vein_gap : 0.0 , router_vein_ridged : 0.0 , router_vein_toggle : 0.0 , grid_router_barrier : [0.0 ; 9] , grid_router_continentalness : [0.0 ; 9] , grid_router_depth : [0.0 ; 9] , grid_router_erosion : [0.0 ; 9] , grid_router_fluid_level_floodedness : [0.0 ; 9] , grid_router_fluid_level_spread : [0.0 ; 9] , grid_router_lava : [0.0 ; 9] , grid_router_preliminary_surface_level : [0.0 ; 9] , grid_router_ridges : [0.0 ; 9] , grid_router_temperature : [0.0 ; 9] , grid_router_vegetation : [0.0 ; 9] , grid_router_vein_gap : [0.0 ; 9] , grid_router_vein_ridged : [0.0 ; 9] , grid_router_vein_toggle : [0.0 ; 9] , } } # [doc = r" Pre-compute flat-cached values for all quart positions in a chunk."] # [doc = r""] # [doc = r" After this call, `ensure()` for in-bounds positions copies from"] # [doc = r" the grid (O(1)). Out-of-bounds positions fall back to on-the-fly"] # [doc = r" evaluation at raw (non-quantized) coordinates."] pub fn init_grid (& mut self , chunk_block_x : i32 , chunk_block_z : i32 , noises : & EndNoises) { self . grid_first_quart_x = chunk_block_x >> 2 ; self . grid_first_quart_z = chunk_block_z >> 2 ; self . has_grid = true ; self . valid = false ; for rel_z in 0 .. Self :: GRID_SIDE { for rel_x in 0 .. Self :: GRID_SIDE { let x = ((self . grid_first_quart_x + rel_x) << 2) as f64 ; let z = ((self . grid_first_quart_z + rel_z) << 2) as f64 ; let idx = (rel_z * Self :: GRID_SIDE + rel_x) as usize ; let val = compute_router_barrier (noises , & * self , x , z) ; self . router_barrier = val ; let val = compute_router_continentalness (noises , & * self , x , z) ; self . router_continentalness = val ; let val = compute_router_depth (noises , & * self , x , z) ; self . router_depth = val ; let val = compute_router_erosion (noises , & * self , x , z) ; self . router_erosion = val ; let val = compute_router_fluid_level_floodedness (noises , & * self , x , z) ; self . router_fluid_level_floodedness = val ; let val = compute_router_fluid_level_spread (noises , & * self , x , z) ; self . router_fluid_level_spread = val ; let val = compute_router_lava (noises , & * self , x , z) ; self . router_lava = val ; let val = compute_router_preliminary_surface_level (noises , & * self , x , z) ; self . router_preliminary_surface_level = val ; let val = compute_router_ridges (noises , & * self , x , z) ; self . router_ridges = val ; let val = compute_router_temperature (noises , & * self , x , z) ; self . router_temperature = val ; let val = compute_router_vegetation (noises , & * self , x , z) ; self . router_vegetation = val ; let val = compute_router_vein_gap (noises , & * self , x , z) ; self . router_vein_gap = val ; let val = compute_router_vein_ridged (noises , & * self , x , z) ; self . router_vein_ridged = val ; let val = compute_router_vein_toggle (noises , & * self , x , z) ; self . router_vein_toggle = val ; self . grid_router_barrier [idx] = self . router_barrier ; self . grid_router_continentalness [idx] = self . router_continentalness ; self . grid_router_depth [idx] = self . router_depth ; self . grid_router_erosion [idx] = self . router_erosion ; self . grid_router_fluid_level_floodedness [idx] = self . router_fluid_level_floodedness ; self . grid_router_fluid_level_spread [idx] = self . router_fluid_level_spread ; self . grid_router_lava [idx] = self . router_lava ; self . grid_router_preliminary_surface_level [idx] = self . router_preliminary_surface_level ; self . grid_router_ridges [idx] = self . router_ridges ; self . grid_router_temperature [idx] = self . router_temperature ; self . grid_router_vegetation [idx] = self . router_vegetation ; self . grid_router_vein_gap [idx] = self . router_vein_gap ; self . grid_router_vein_ridged [idx] = self . router_vein_ridged ; self . grid_router_vein_toggle [idx] = self . router_vein_toggle ; } } } # [doc = r" Ensure the cache is populated for the given `(x, z)` block coordinates."] # [doc = r""] # [doc = r" With a grid: in-bounds positions load from the pre-computed grid,"] # [doc = r" out-of-bounds positions compute at raw (non-quantized) coordinates."] # [doc = r" Without a grid: always quantizes and lazy-computes (single-entry cache)."] pub fn ensure (& mut self , x : i32 , z : i32 , noises : & EndNoises) { self . x = x ; self . z = z ; let quart_x = x >> 2 ; let quart_z = z >> 2 ; if self . has_grid { let rel_x = quart_x - self . grid_first_quart_x ; let rel_z = quart_z - self . grid_first_quart_z ; if rel_x >= 0 && rel_z >= 0 && rel_x < Self :: GRID_SIDE && rel_z < Self :: GRID_SIDE { let eval_x = quart_x << 2 ; let eval_z = quart_z << 2 ; if self . valid && self . qx == eval_x && self . qz == eval_z { return ; } let idx = (rel_z * Self :: GRID_SIDE + rel_x) as usize ; self . router_barrier = self . grid_router_barrier [idx] ; self . router_continentalness = self . grid_router_continentalness [idx] ; self . router_depth = self . grid_router_depth [idx] ; self . router_erosion = self . grid_router_erosion [idx] ; self . router_fluid_level_floodedness = self . grid_router_fluid_level_floodedness [idx] ; self . router_fluid_level_spread = self . grid_router_fluid_level_spread [idx] ; self . router_lava = self . grid_router_lava [idx] ; self . router_preliminary_surface_level = self . grid_router_preliminary_surface_level [idx] ; self . router_ridges = self . grid_router_ridges [idx] ; self . router_temperature = self . grid_router_temperature [idx] ; self . router_vegetation = self . grid_router_vegetation [idx] ; self . router_vein_gap = self . grid_router_vein_gap [idx] ; self . router_vein_ridged = self . grid_router_vein_ridged [idx] ; self . router_vein_toggle = self . grid_router_vein_toggle [idx] ; self . qx = eval_x ; self . qz = eval_z ; self . valid = true ; return ; } if self . valid && self . qx == x && self . qz == z { return ; } self . qx = x ; self . qz = z ; let x = x as f64 ; let z = z as f64 ; let val = compute_router_barrier (noises , & * self , x , z) ; self . router_barrier = val ; let val = compute_router_continentalness (noises , & * self , x , z) ; self . router_continentalness = val ; let val = compute_router_depth (noises , & * self , x , z) ; self . router_depth = val ; let val = compute_router_erosion (noises , & * self , x , z) ; self . router_erosion = val ; let val = compute_router_fluid_level_floodedness (noises , & * self , x , z) ; self . router_fluid_level_floodedness = val ; let val = compute_router_fluid_level_spread (noises , & * self , x , z) ; self . router_fluid_level_spread = val ; let val = compute_router_lava (noises , & * self , x , z) ; self . router_lava = val ; let val = compute_router_preliminary_surface_level (noises , & * self , x , z) ; self . router_preliminary_surface_level = val ; let val = compute_router_ridges (noises , & * self , x , z) ; self . router_ridges = val ; let val = compute_router_temperature (noises , & * self , x , z) ; self . router_temperature = val ; let val = compute_router_vegetation (noises , & * self , x , z) ; self . router_vegetation = val ; let val = compute_router_vein_gap (noises , & * self , x , z) ; self . router_vein_gap = val ; let val = compute_router_vein_ridged (noises , & * self , x , z) ; self . router_vein_ridged = val ; let val = compute_router_vein_toggle (noises , & * self , x , z) ; self . router_vein_toggle = val ; self . valid = true ; return ; } let eval_x = quart_x << 2 ; let eval_z = quart_z << 2 ; if self . valid && self . qx == eval_x && self . qz == eval_z { return ; } self . qx = eval_x ; self . qz = eval_z ; let x = eval_x as f64 ; let z = eval_z as f64 ; let val = compute_router_barrier (noises , & * self , x , z) ; self . router_barrier = val ; let val = compute_router_continentalness (noises , & * self , x , z) ; self . router_continentalness = val ; let val = compute_router_depth (noises , & * self , x , z) ; self . router_depth = val ; let val = compute_router_erosion (noises , & * self , x , z) ; self . router_erosion = val ; let val = compute_router_fluid_level_floodedness (noises , & * self , x , z) ; self . router_fluid_level_floodedness = val ; let val = compute_router_fluid_level_spread (noises , & * self , x , z) ; self . router_fluid_level_spread = val ; let val = compute_router_lava (noises , & * self , x , z) ; self . router_lava = val ; let val = compute_router_preliminary_surface_level (noises , & * self , x , z) ; self . router_preliminary_surface_level = val ; let val = compute_router_ridges (noises , & * self , x , z) ; self . router_ridges = val ; let val = compute_router_temperature (noises , & * self , x , z) ; self . router_temperature = val ; let val = compute_router_vegetation (noises , & * self , x , z) ; self . router_vegetation = val ; let val = compute_router_vein_gap (noises , & * self , x , z) ; self . router_vein_gap = val ; let val = compute_router_vein_ridged (noises , & * self , x , z) ; self . router_vein_ridged = val ; let val = compute_router_vein_toggle (noises , & * self , x , z) ; self . router_vein_toggle = val ; self . valid = true ; } } # [doc = "`minecraft:end/base_3d_noise`"] # [inline] fn compute_end__base_3d_noise (noises : & EndNoises , cache : & EndColumnCache , x : f64 , y : f64 , z : f64) -> f64 { noises . blended_noise . compute (x , y , z) } # [doc = "`minecraft:end/sloped_cheese`"] # [inline] fn compute_end__sloped_cheese (noises : & EndNoises , cache : & EndColumnCache , x : f64 , y : f64 , z : f64) -> f64 { ((noises . end_islands . sample (x , y , z)) + (compute_end__base_3d_noise (noises , cache , x , y , z))) } # [doc = "`minecraft:end/base_3d_noise` (SIMD form, batches 4 Y values)"] # [allow (dead_code)] # [inline] fn compute_end__base_3d_noise_4x (noises : & EndNoises , cache : & EndColumnCache , x : f64 , ys : f64x4 , z : f64) -> f64x4 { { let __ys_arr = ys . to_array () ; let __r0 = { # [allow (clippy :: cast_possible_truncation)] let y = __ys_arr [0] ; noises . blended_noise . compute (x , y , z) } ; let __r1 = { # [allow (clippy :: cast_possible_truncation)] let y = __ys_arr [1] ; noises . blended_noise . compute (x , y , z) } ; let __r2 = { # [allow (clippy :: cast_possible_truncation)] let y = __ys_arr [2] ; noises . blended_noise . compute (x , y , z) } ; let __r3 = { # [allow (clippy :: cast_possible_truncation)] let y = __ys_arr [3] ; noises . blended_noise . compute (x , y , z) } ; f64x4 :: from_array ([__r0 , __r1 , __r2 , __r3]) } } # [doc = "`minecraft:end/sloped_cheese` (SIMD form, batches 4 Y values)"] # [allow (dead_code)] # [inline] fn compute_end__sloped_cheese_4x (noises : & EndNoises , cache : & EndColumnCache , x : f64 , ys : f64x4 , z : f64) -> f64x4 { ((f64x4 :: splat (noises . end_islands . sample (x , 0.0 , z))) + (compute_end__base_3d_noise_4x (noises , cache , x , ys , z))) } # [inline] fn compute_router_barrier (noises : & EndNoises , cache : & EndColumnCache , x : f64 , z : f64) -> f64 { 0.0 } # [doc = "Noise router entry: `barrier`"] # [inline] pub fn router_barrier (noises : & EndNoises , cache : & EndColumnCache , x : f64 , y : f64 , z : f64) -> f64 { cache . router_barrier } # [inline] fn compute_router_continentalness (noises : & EndNoises , cache : & EndColumnCache , x : f64 , z : f64) -> f64 { 0.0 } # [doc = "Noise router entry: `continentalness`"] # [inline] pub fn router_continentalness (noises : & EndNoises , cache : & EndColumnCache , x : f64 , y : f64 , z : f64) -> f64 { cache . router_continentalness } # [inline] fn compute_router_depth (noises : & EndNoises , cache : & EndColumnCache , x : f64 , z : f64) -> f64 { 0.0 } # [doc = "Noise router entry: `depth`"] # [inline] pub fn router_depth (noises : & EndNoises , cache : & EndColumnCache , x : f64 , y : f64 , z : f64) -> f64 { cache . router_depth } # [inline] fn compute_router_erosion (noises : & EndNoises , cache : & EndColumnCache , x : f64 , z : f64) -> f64 { noises . end_islands . sample (x , 0.0 , z) } # [doc = "Noise router entry: `erosion`"] # [inline] pub fn router_erosion (noises : & EndNoises , cache : & EndColumnCache , x : f64 , y : f64 , z : f64) -> f64 { cache . router_erosion } # [doc = "Noise router entry: `final_density`"] # [inline] pub fn router_final_density (noises : & EndNoises , cache : & EndColumnCache , x : f64 , y : f64 , z : f64) -> f64 { let x = cache . x as f64 ; let z = cache . z as f64 ; { let c = clamp (((0.64) * (((- 0.234375) + (((map_clamped (y , 4.0 , 32.0 , 0.0 , 1.0)) * (((0.234375) + (((- 23.4375) + (((map_clamped (y , 56.0 , 312.0 , 1.0 , 0.0)) * (((23.4375) + (compute_end__sloped_cheese (noises , cache , x , y , z))))))))))))))) , - 1.0 , 1.0) ; c / 2.0 - c * c * c / 24.0 } } # [inline] fn compute_router_fluid_level_floodedness (noises : & EndNoises , cache : & EndColumnCache , x : f64 , z : f64) -> f64 { 0.0 } # [doc = "Noise router entry: `fluid_level_floodedness`"] # [inline] pub fn router_fluid_level_floodedness (noises : & EndNoises , cache : & EndColumnCache , x : f64 , y : f64 , z : f64) -> f64 { cache . router_fluid_level_floodedness } # [inline] fn compute_router_fluid_level_spread (noises : & EndNoises , cache : & EndColumnCache , x : f64 , z : f64) -> f64 { 0.0 } # [doc = "Noise router entry: `fluid_level_spread`"] # [inline] pub fn router_fluid_level_spread (noises : & EndNoises , cache : & EndColumnCache , x : f64 , y : f64 , z : f64) -> f64 { cache . router_fluid_level_spread } # [inline] fn compute_router_lava (noises : & EndNoises , cache : & EndColumnCache , x : f64 , z : f64) -> f64 { 0.0 } # [doc = "Noise router entry: `lava`"] # [inline] pub fn router_lava (noises : & EndNoises , cache : & EndColumnCache , x : f64 , y : f64 , z : f64) -> f64 { cache . router_lava } # [inline] fn compute_router_preliminary_surface_level (noises : & EndNoises , cache : & EndColumnCache , x : f64 , z : f64) -> f64 { 0.0 } # [doc = "Noise router entry: `preliminary_surface_level`"] # [inline] pub fn router_preliminary_surface_level (noises : & EndNoises , cache : & EndColumnCache , x : f64 , y : f64 , z : f64) -> f64 { cache . router_preliminary_surface_level } # [inline] fn compute_router_ridges (noises : & EndNoises , cache : & EndColumnCache , x : f64 , z : f64) -> f64 { 0.0 } # [doc = "Noise router entry: `ridges`"] # [inline] pub fn router_ridges (noises : & EndNoises , cache : & EndColumnCache , x : f64 , y : f64 , z : f64) -> f64 { cache . router_ridges } # [inline] fn compute_router_temperature (noises : & EndNoises , cache : & EndColumnCache , x : f64 , z : f64) -> f64 { 0.0 } # [doc = "Noise router entry: `temperature`"] # [inline] pub fn router_temperature (noises : & EndNoises , cache : & EndColumnCache , x : f64 , y : f64 , z : f64) -> f64 { cache . router_temperature } # [inline] fn compute_router_vegetation (noises : & EndNoises , cache : & EndColumnCache , x : f64 , z : f64) -> f64 { 0.0 } # [doc = "Noise router entry: `vegetation`"] # [inline] pub fn router_vegetation (noises : & EndNoises , cache : & EndColumnCache , x : f64 , y : f64 , z : f64) -> f64 { cache . router_vegetation } # [inline] fn compute_router_vein_gap (noises : & EndNoises , cache : & EndColumnCache , x : f64 , z : f64) -> f64 { 0.0 } # [doc = "Noise router entry: `vein_gap`"] # [inline] pub fn router_vein_gap (noises : & EndNoises , cache : & EndColumnCache , x : f64 , y : f64 , z : f64) -> f64 { cache . router_vein_gap } # [inline] fn compute_router_vein_ridged (noises : & EndNoises , cache : & EndColumnCache , x : f64 , z : f64) -> f64 { 0.0 } # [doc = "Noise router entry: `vein_ridged`"] # [inline] pub fn router_vein_ridged (noises : & EndNoises , cache : & EndColumnCache , x : f64 , y : f64 , z : f64) -> f64 { cache . router_vein_ridged } # [inline] fn compute_router_vein_toggle (noises : & EndNoises , cache : & EndColumnCache , x : f64 , z : f64) -> f64 { 0.0 } # [doc = "Noise router entry: `vein_toggle`"] # [inline] pub fn router_vein_toggle (noises : & EndNoises , cache : & EndColumnCache , x : f64 , y : f64 , z : f64) -> f64 { cache . router_vein_toggle } # [doc = r" Total number of independently interpolated channels across all"] # [doc = r" router entries (final_density + vein_toggle + vein_ridged)."] pub const INTERPOLATED_COUNT : usize = 1 ; # [doc = r" Whether vein functions have interpolation channels."] pub const VEIN_INTERP_ENABLED : bool = false ; # [doc = r" Evaluate the inner functions of all `Interpolated` markers at a cell corner."] # [doc = r""] # [doc = r" `out` must have length `INTERPOLATED_COUNT`."] # [expect (unused_variables , reason = "generated function has a fixed signature; blended_noise_value is unused in dimensions without blended noise")] pub fn fill_cell_corner_densities (noises : & EndNoises , cache : & EndColumnCache , x : i32 , y : i32 , z : i32 , blended_noise_value : f64 , out : & mut [f64] ,) { let x = cache . x as f64 ; let z = cache . z as f64 ; let y = y as f64 ; out [0] = ((0.64) * (((- 0.234375) + (((map_clamped (y , 4.0 , 32.0 , 0.0 , 1.0)) * (((0.234375) + (((- 23.4375) + (((map_clamped (y , 56.0 , 312.0 , 1.0 , 0.0)) * (((23.4375) + (((noises . end_islands . sample (x , y , z)) + (blended_noise_value)))))))))))))))) ; } # [doc = r" SIMD form of [`fill_cell_corner_densities`] that batches 4"] # [doc = r" cell-corner Y values at fixed `(x, z)`."] # [doc = r""] # [doc = r" `out` layout: lane-major SoA. Lane `i`'s `INTERPOLATED_COUNT`"] # [doc = r" channels live at `out[i * INTERPOLATED_COUNT..(i + 1) * INTERPOLATED_COUNT]`."] # [doc = r" `out` must have length `4 * INTERPOLATED_COUNT`."] # [doc = r""] # [doc = r" Per-lane semantics are bit-identical to four scalar"] # [doc = r" [`fill_cell_corner_densities`] calls at the same Y values."] # [expect (unused_variables , reason = "generated function has a fixed signature; not all dimensions use every parameter")] pub fn fill_cell_corner_densities_4x (noises : & EndNoises , cache : & EndColumnCache , x : i32 , ys : f64x4 , z : i32 , blended_noise_value_v : f64x4 , out : & mut [f64] ,) { let x = cache . x as f64 ; let z = cache . z as f64 ; { let __r = ((f64x4 :: splat (0.64)) * (((f64x4 :: splat (- 0.234375)) + ((({ let __t = (ys - f64x4 :: splat (4.0)) / f64x4 :: splat (32.0 - 4.0) ; let __min = f64x4 :: splat (0.0) ; let __max = f64x4 :: splat (1.0) ; let __lerped = __min + __t * (__max - __min) ; let __below = __t . simd_lt (f64x4 :: splat (0.0)) ; let __above = __t . simd_gt (f64x4 :: splat (1.0)) ; let __r = __above . select (__max , __lerped) ; __below . select (__min , __r) }) * (((f64x4 :: splat (0.234375)) + (((f64x4 :: splat (- 23.4375)) + ((({ let __t = (ys - f64x4 :: splat (56.0)) / f64x4 :: splat (312.0 - 56.0) ; let __min = f64x4 :: splat (1.0) ; let __max = f64x4 :: splat (0.0) ; let __lerped = __min + __t * (__max - __min) ; let __below = __t . simd_lt (f64x4 :: splat (0.0)) ; let __above = __t . simd_gt (f64x4 :: splat (1.0)) ; let __r = __above . select (__max , __lerped) ; __below . select (__min , __r) }) * (((f64x4 :: splat (23.4375)) + (((f64x4 :: splat (noises . end_islands . sample (x , 0.0 , z))) + (blended_noise_value_v)))))))))))))))) ; out [0] = __r [0] ; out [0 + INTERPOLATED_COUNT] = __r [1] ; out [0 + 2 * INTERPOLATED_COUNT] = __r [2] ; out [0 + 3 * INTERPOLATED_COUNT] = __r [3] ; } } # [doc = r" Combine interpolated values for `final_density`."] # [expect (unused_variables , reason = "generated function has a fixed signature; not all parameters are used in every dimension")] pub fn combine_interpolated (noises : & EndNoises , cache : & EndColumnCache , interpolated : & [f64] , _x : i32 , y : i32 , _z : i32 ,) -> f64 { let x = cache . x as f64 ; let z = cache . z as f64 ; let y = y as f64 ; { let c = clamp (interpolated [0] , - 1.0 , 1.0) ; c / 2.0 - c * c * c / 24.0 } } # [doc = r" Combine interpolated values for `vein_toggle`."] # [expect (unused_variables , reason = "generated function has a fixed signature; not all parameters are used in every dimension")] pub fn combine_vein_toggle (noises : & EndNoises , cache : & EndColumnCache , interpolated : & [f64] , _x : i32 , y : i32 , _z : i32 ,) -> f64 { let x = cache . x as f64 ; let z = cache . z as f64 ; let y = y as f64 ; 0.0 } # [doc = r" Combine interpolated values for `vein_ridged`."] # [expect (unused_variables , reason = "generated function has a fixed signature; not all parameters are used in every dimension")] pub fn combine_vein_ridged (noises : & EndNoises , cache : & EndColumnCache , interpolated : & [f64] , _x : i32 , y : i32 , _z : i32 ,) -> f64 { let x = cache . x as f64 ; let z = cache . z as f64 ; let y = y as f64 ; 0.0 } # [doc = r" Noise settings for this dimension, parsed from the datapack."] pub struct EndNoiseSettings ; impl EndNoiseSettings { # [doc = r" Minimum Y coordinate for this dimension."] pub const MIN_Y : i32 = 0i32 ; # [doc = r" Total height of the world in blocks."] pub const HEIGHT : i32 = 128i32 ; # [doc = r" Sea level Y coordinate."] pub const SEA_LEVEL : i32 = 0i32 ; # [doc = r" Cell width in blocks (XZ)."] pub const CELL_WIDTH : i32 = 8i32 ; # [doc = r" Cell height in blocks (Y)."] pub const CELL_HEIGHT : i32 = 4i32 ; # [doc = r" Whether aquifers are enabled."] pub const AQUIFERS_ENABLED : bool = false ; # [doc = r" Whether ore veins are enabled."] pub const ORE_VEINS_ENABLED : bool = false ; # [doc = r" Whether this dimension uses Java's LCG random (true) or Xoroshiro (false)."] pub const LEGACY_RANDOM_SOURCE : bool = true ; # [doc = r" Get the default block state ID for this dimension."] # [inline] pub fn default_block_id () -> steel_utils :: BlockStateId { steel_registry :: REGISTRY . blocks . get_default_state_id (& steel_registry :: vanilla_blocks :: END_STONE) } # [doc = r" Get the default fluid state ID for this dimension."] # [inline] pub fn default_fluid_id () -> steel_utils :: BlockStateId { steel_registry :: REGISTRY . blocks . get_default_state_id (& steel_registry :: vanilla_blocks :: AIR) } } impl steel_worldgen :: density :: NoiseSettings for EndNoiseSettings { const MIN_Y : i32 = 0i32 ; const HEIGHT : i32 = 128i32 ; const SEA_LEVEL : i32 = 0i32 ; const CELL_WIDTH : i32 = 8i32 ; const CELL_HEIGHT : i32 = 4i32 ; const AQUIFERS_ENABLED : bool = false ; const ORE_VEINS_ENABLED : bool = false ; const LEGACY_RANDOM_SOURCE : bool = true ; # [inline] fn default_block_id () -> steel_utils :: BlockStateId { EndNoiseSettings :: default_block_id () } # [inline] fn default_fluid_id () -> steel_utils :: BlockStateId { EndNoiseSettings :: default_fluid_id () } } impl Default for EndColumnCache { fn default () -> Self { Self :: new () } } impl steel_worldgen :: density :: ColumnCache for EndColumnCache { type Noises = EndNoises ; # [inline] fn ensure (& mut self , x : i32 , z : i32 , noises : & Self :: Noises) { EndColumnCache :: ensure (self , x , z , noises) } # [inline] fn init_grid (& mut self , chunk_block_x : i32 , chunk_block_z : i32 , noises : & Self :: Noises) { EndColumnCache :: init_grid (self , chunk_block_x , chunk_block_z , noises) } } impl steel_worldgen :: density :: DimensionNoises for EndNoises { type ColumnCache = EndColumnCache ; type Settings = EndNoiseSettings ; fn create (seed : u64 , splitter : & steel_utils :: random :: RandomSplitter , params : & rustc_hash :: FxHashMap < String , steel_worldgen :: density :: NoiseParameters > ,) -> Self { EndNoises :: create (seed , splitter , params) } # [inline] fn router_final_density (& self , cache : & mut Self :: ColumnCache , x : i32 , y : i32 , z : i32) -> f64 { router_final_density (self , cache , x as f64 , y as f64 , z as f64) } # [inline] fn router_depth (& self , cache : & mut Self :: ColumnCache , x : i32 , y : i32 , z : i32) -> f64 { router_depth (self , cache , x as f64 , y as f64 , z as f64) } # [inline] fn router_barrier (& self , cache : & mut Self :: ColumnCache , x : i32 , y : i32 , z : i32) -> f64 { router_barrier (self , cache , x as f64 , y as f64 , z as f64) } # [inline] fn router_fluid_level_floodedness (& self , cache : & mut Self :: ColumnCache , x : i32 , y : i32 , z : i32) -> f64 { router_fluid_level_floodedness (self , cache , x as f64 , y as f64 , z as f64) } # [inline] fn router_fluid_level_spread (& self , cache : & mut Self :: ColumnCache , x : i32 , y : i32 , z : i32) -> f64 { router_fluid_level_spread (self , cache , x as f64 , y as f64 , z as f64) } # [inline] fn router_lava (& self , cache : & mut Self :: ColumnCache , x : i32 , y : i32 , z : i32) -> f64 { router_lava (self , cache , x as f64 , y as f64 , z as f64) } # [inline] fn router_vein_toggle (& self , cache : & mut Self :: ColumnCache , x : i32 , y : i32 , z : i32) -> f64 { router_vein_toggle (self , cache , x as f64 , y as f64 , z as f64) } # [inline] fn router_vein_ridged (& self , cache : & mut Self :: ColumnCache , x : i32 , y : i32 , z : i32) -> f64 { router_vein_ridged (self , cache , x as f64 , y as f64 , z as f64) } # [inline] fn router_vein_gap (& self , cache : & mut Self :: ColumnCache , x : i32 , y : i32 , z : i32) -> f64 { router_vein_gap (self , cache , x as f64 , y as f64 , z as f64) } # [inline] fn router_erosion (& self , cache : & mut Self :: ColumnCache , x : i32 , y : i32 , z : i32) -> f64 { router_erosion (self , cache , x as f64 , y as f64 , z as f64) } # [inline] fn router_continentalness (& self , cache : & mut Self :: ColumnCache , x : i32 , y : i32 , z : i32) -> f64 { router_continentalness (self , cache , x as f64 , y as f64 , z as f64) } # [inline] fn router_temperature (& self , cache : & mut Self :: ColumnCache , x : i32 , y : i32 , z : i32) -> f64 { router_temperature (self , cache , x as f64 , y as f64 , z as f64) } # [inline] fn router_vegetation (& self , cache : & mut Self :: ColumnCache , x : i32 , y : i32 , z : i32) -> f64 { router_vegetation (self , cache , x as f64 , y as f64 , z as f64) } # [inline] fn router_ridges (& self , cache : & mut Self :: ColumnCache , x : i32 , y : i32 , z : i32) -> f64 { router_ridges (self , cache , x as f64 , y as f64 , z as f64) } # [inline] fn router_preliminary_surface_level (& self , cache : & mut Self :: ColumnCache , x : i32 , y : i32 , z : i32) -> f64 { router_preliminary_surface_level (self , cache , x as f64 , y as f64 , z as f64) } # [inline] fn interpolated_count () -> usize { INTERPOLATED_COUNT } fn vein_interp_enabled () -> bool { VEIN_INTERP_ENABLED } # [inline] fn compute_noise_column (& self , x : i32 , block_ys : & [i32] , z : i32 , out : & mut [f64]) { self . blended_noise . compute_column (x , block_ys , z , out) ; } # [inline] fn fill_cell_corner_densities (& self , cache : & mut Self :: ColumnCache , x : i32 , y : i32 , z : i32 , blended_noise_value : f64 , out : & mut [f64]) { fill_cell_corner_densities (self , cache , x , y , z , blended_noise_value , out) } # [inline] fn fill_cell_corner_densities_4x (& self , cache : & mut Self :: ColumnCache , x : i32 , ys : std :: simd :: f64x4 , z : i32 , blended_noise_values : std :: simd :: f64x4 , out : & mut [f64] ,) { fill_cell_corner_densities_4x (self , cache , x , ys , z , blended_noise_values , out) } # [inline] fn combine_interpolated (& self , cache : & mut Self :: ColumnCache , interpolated : & [f64] , x : i32 , y : i32 , z : i32) -> f64 { combine_interpolated (self , cache , interpolated , x , y , z) } # [inline] fn combine_vein_toggle (& self , cache : & mut Self :: ColumnCache , interpolated : & [f64] , x : i32 , y : i32 , z : i32) -> f64 { combine_vein_toggle (self , cache , interpolated , x , y , z) } # [inline] fn combine_vein_ridged (& self , cache : & mut Self :: ColumnCache , interpolated : & [f64] , x : i32 , y : i32 , z : i32) -> f64 { combine_vein_ridged (self , cache , interpolated , x , y , z) } fn surface_noise_ids () -> & 'static [& 'static str] { & [] } fn surface_gradient_ids () -> & 'static [& 'static str] { & [] } fn surface_rule_block_states () -> & 'static [steel_utils :: BlockStateId] { { static BLOCK_STATES : std :: sync :: OnceLock < Box < [steel_utils :: BlockStateId] >> = std :: sync :: OnceLock :: new () ; BLOCK_STATES . get_or_init (|| { Box :: from ([steel_registry :: vanilla_blocks :: END_STONE . default_state ()]) }) } } fn surface_rule_uses_biome () -> bool { false } fn surface_rule_uses_preliminary_surface () -> bool { false } fn surface_rule_uses_surface_secondary () -> bool { false } fn surface_rule_uses_steep () -> bool { false } fn try_apply_surface_rule (ctx : & mut steel_worldgen :: surface :: SurfaceRuleContext < '_ > ,) -> Option < steel_utils :: BlockStateId > { Self :: apply_surface_rule_impl (ctx) } } impl EndNoises { # [doc = r" Apply this dimension's surface rule at the current context position."] # [allow (clippy :: collapsible_if , clippy :: needless_return , clippy :: erasing_op , unused_comparisons)] fn apply_surface_rule_impl (ctx : & mut steel_worldgen :: surface :: SurfaceRuleContext < '_ > ,) -> Option < steel_utils :: BlockStateId > { return Some (ctx . block_state (0usize)) ; None } }