pub struct SurfaceSystem {Show 18 fields
surface_noise: NormalNoise,
surface_secondary_noise: NormalNoise,
clay_bands_offset_noise: NormalNoise,
clay_bands: [BlockStateId; 192],
noise_random: RandomSplitter,
condition_noises: Vec<NormalNoise>,
vertical_gradient_randoms: Vec<RandomSplitter>,
badlands_pillar_noise: NormalNoise,
badlands_pillar_roof_noise: NormalNoise,
badlands_surface_noise: NormalNoise,
iceberg_pillar_noise: NormalNoise,
iceberg_pillar_roof_noise: NormalNoise,
iceberg_surface_noise: NormalNoise,
temperature_noise: PerlinSimplexNoise,
frozen_temperature_noise: PerlinSimplexNoise,
biome_info_noise: PerlinSimplexNoise,
pub default_block: BlockStateId,
pub sea_level: i32,
}Expand description
Runtime surface system holding noises and clay band data.
Matches vanilla’s SurfaceSystem. Constructed once per generator and
shared across all chunk generation calls.
Fields§
§surface_noise: NormalNoiseSurface depth noise (minecraft:surface).
surface_secondary_noise: NormalNoiseSurface secondary noise (minecraft:surface_secondary).
clay_bands_offset_noise: NormalNoiseClay bands offset noise (minecraft:clay_bands_offset).
clay_bands: [BlockStateId; 192]Pre-generated terracotta band pattern (192 entries).
noise_random: RandomSplitterPositional random factory for surface depth jitter and frozen ocean.
condition_noises: Vec<NormalNoise>Condition noises used by NoiseThreshold surface rules.
Indexed in the same order as DimensionNoises::surface_noise_ids().
vertical_gradient_randoms: Vec<RandomSplitter>Positional random factories used by VerticalGradient surface rules.
badlands_pillar_noise: NormalNoise§badlands_pillar_roof_noise: NormalNoise§badlands_surface_noise: NormalNoise§iceberg_pillar_noise: NormalNoise§iceberg_pillar_roof_noise: NormalNoise§iceberg_surface_noise: NormalNoise§temperature_noise: PerlinSimplexNoiseTemperature noise for height-based adjustments (seed 1234, octave 0).
frozen_temperature_noise: PerlinSimplexNoiseFrozen biome temperature noise (seed 3456, octaves [-2,-1,0]).
biome_info_noise: PerlinSimplexNoiseBiome info noise for frozen patches (seed 2345, octave 0).
default_block: BlockStateIdDefault block state for this dimension.
sea_level: i32Sea level for this dimension.
Implementations§
Source§impl SurfaceSystem
impl SurfaceSystem
Sourcepub fn new(
splitter: &RandomSplitter,
noise_params: &FxHashMap<String, NoiseParameters>,
condition_noise_ids: &[&str],
vertical_gradient_ids: &[&str],
default_block: BlockStateId,
sea_level: i32,
) -> Self
pub fn new( splitter: &RandomSplitter, noise_params: &FxHashMap<String, NoiseParameters>, condition_noise_ids: &[&str], vertical_gradient_ids: &[&str], default_block: BlockStateId, sea_level: i32, ) -> Self
Create a new surface system.
condition_noise_ids lists the noise IDs referenced by NoiseThreshold
conditions in the transpiled surface rules.
Sourcepub fn get_surface_depth(&self, x: i32, z: i32) -> i32
pub fn get_surface_depth(&self, x: i32, z: i32) -> i32
Compute the surface depth at a column position.
Matches vanilla’s SurfaceSystem.getSurfaceDepth():
(int)(noise * 2.75 + 3.0 + random.at(x, 0, z).nextDouble() * 0.25)
Sourcepub fn get_surface_secondary(&self, x: i32, z: i32) -> f64
pub fn get_surface_secondary(&self, x: i32, z: i32) -> f64
Sample the surface secondary noise at a column position.
Sourcefn frozen_large_x7(&self, xz: &mut TemperatureXzCache) -> f64
fn frozen_large_x7(&self, xz: &mut TemperatureXzCache) -> f64
frozen_temperature_noise.get_value(x*0.05, z*0.05) * 7.0, lazily
cached on first access. NaN sentinel = not yet computed.
Sourcefn frozen_edge(&self, xz: &mut TemperatureXzCache) -> f64
fn frozen_edge(&self, xz: &mut TemperatureXzCache) -> f64
biome_info_noise.get_value(x*0.2, z*0.2), lazily cached.
Sourcefn frozen_small(&self, xz: &mut TemperatureXzCache) -> f64
fn frozen_small(&self, xz: &mut TemperatureXzCache) -> f64
biome_info_noise.get_value(x*0.09, z*0.09), lazily cached.
Sourcefn height_temp_noise_x8(&self, xz: &mut TemperatureXzCache) -> f64
fn height_temp_noise_x8(&self, xz: &mut TemperatureXzCache) -> f64
temperature_noise.get_value(x/8, z/8) * 8.0, lazily cached.
Sourcefn get_temperature(
&self,
biome_id: u16,
block_y: i32,
xz: &mut TemperatureXzCache,
) -> f32
fn get_temperature( &self, biome_id: u16, block_y: i32, xz: &mut TemperatureXzCache, ) -> f32
Compute the effective temperature at a position, using a column-local XZ cache.
Matches vanilla’s Biome.getTemperature() with the temperature modifier
and height-based adjustment above sea_level + 17. All three contributing
noise samples are 2D (XZ-only), so reusing them across every Y in a column
is determinism-preserving.
§Panics
Panics if biome_id does not correspond to a registered biome.
Sourcepub fn cold_enough_to_snow(
&self,
biome_id: u16,
block_y: i32,
xz: &mut TemperatureXzCache,
) -> bool
pub fn cold_enough_to_snow( &self, biome_id: u16, block_y: i32, xz: &mut TemperatureXzCache, ) -> bool
Check if a position is cold enough to snow.
Matches vanilla’s Biome.coldEnoughToSnow() → !warmEnoughToRain() →
getTemperature() >= 0.15. Takes a column-local xz cache so the
XZ-only noise samples are reused across every Y in the column scan.
Sourcefn should_melt_frozen_ocean_iceberg_slightly(
&self,
biome_id: u16,
block_x: i32,
block_z: i32,
) -> bool
fn should_melt_frozen_ocean_iceberg_slightly( &self, biome_id: u16, block_x: i32, block_z: i32, ) -> bool
Check if an iceberg at this position should melt slightly.
Matches vanilla’s Biome.shouldMeltFrozenOceanIcebergSlightly().
Temperature is evaluated at sea level.
Sourcefn generate_bands(random: &mut RandomSource) -> [BlockStateId; 192]
fn generate_bands(random: &mut RandomSource) -> [BlockStateId; 192]
Generate the 192-element terracotta band pattern.
Matches vanilla’s SurfaceSystem.generateBands().
Sourcefn make_bands(
random: &mut RandomSource,
bands: &mut [BlockStateId; 192],
base_width: i32,
state: BlockStateId,
)
fn make_bands( random: &mut RandomSource, bands: &mut [BlockStateId; 192], base_width: i32, state: BlockStateId, )
Place random bands of a single color.
Matches vanilla’s SurfaceSystem.makeBands().
Source§impl SurfaceSystem
impl SurfaceSystem
Sourcepub fn eroded_badlands_extension(
&self,
chunk: GenerationChunk<'_, SurfacePhase>,
local_x: usize,
local_z: usize,
block_x: i32,
block_z: i32,
height: i32,
min_y: i32,
) -> i32
pub fn eroded_badlands_extension( &self, chunk: GenerationChunk<'_, SurfacePhase>, local_x: usize, local_z: usize, block_x: i32, block_z: i32, height: i32, min_y: i32, ) -> i32
Eroded badlands extension — adds terracotta pillars above the surface.
Matches vanilla’s SurfaceSystem.erodedBadlandsExtension().
Returns the new start_height if blocks were added above the original surface.
Sourcepub fn collect_frozen_ocean_extension_writes(
&self,
biome_id: u16,
block_x: i32,
block_z: i32,
height: i32,
min_surface_level: i32,
min_y: i32,
column: &[BlockStateId],
writes: &mut Vec<(usize, BlockStateId)>,
)
pub fn collect_frozen_ocean_extension_writes( &self, biome_id: u16, block_x: i32, block_z: i32, height: i32, min_surface_level: i32, min_y: i32, column: &[BlockStateId], writes: &mut Vec<(usize, BlockStateId)>, )
Frozen ocean iceberg extension — adds packed ice and snow blocks.
Collects the same writes as vanilla’s SurfaceSystem.frozenOceanExtension().
Called after surface rules for frozen ocean / deep frozen ocean biomes.
Trait Implementations§
Source§impl SurfaceNoiseProvider for SurfaceSystem
impl SurfaceNoiseProvider for SurfaceSystem
Source§fn condition_noise(&self, noise_index: usize, x: i32, z: i32) -> f64
fn condition_noise(&self, noise_index: usize, x: i32, z: i32) -> f64
surface_noise_ids() list.Source§fn condition_noise_3d(&self, noise_index: usize, x: i32, y: i32, z: i32) -> f64
fn condition_noise_3d(&self, noise_index: usize, x: i32, y: i32, z: i32) -> f64
surface_noise_ids() list.Source§fn get_band(&self, x: i32, y: i32, z: i32) -> BlockStateId
fn get_band(&self, x: i32, y: i32, z: i32) -> BlockStateId
Auto Trait Implementations§
impl Freeze for SurfaceSystem
impl RefUnwindSafe for SurfaceSystem
impl Send for SurfaceSystem
impl Sync for SurfaceSystem
impl Unpin for SurfaceSystem
impl UnsafeUnpin for SurfaceSystem
impl UnwindSafe for SurfaceSystem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreArc<SyncMutex<>>