Skip to main content

SurfaceSystem

Struct SurfaceSystem 

Source
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: NormalNoise

Surface depth noise (minecraft:surface).

§surface_secondary_noise: NormalNoise

Surface secondary noise (minecraft:surface_secondary).

§clay_bands_offset_noise: NormalNoise

Clay bands offset noise (minecraft:clay_bands_offset).

§clay_bands: [BlockStateId; 192]

Pre-generated terracotta band pattern (192 entries).

§noise_random: RandomSplitter

Positional 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: PerlinSimplexNoise

Temperature noise for height-based adjustments (seed 1234, octave 0).

§frozen_temperature_noise: PerlinSimplexNoise

Frozen biome temperature noise (seed 3456, octaves [-2,-1,0]).

§biome_info_noise: PerlinSimplexNoise

Biome info noise for frozen patches (seed 2345, octave 0).

§default_block: BlockStateId

Default block state for this dimension.

§sea_level: i32

Sea level for this dimension.

Implementations§

Source§

impl SurfaceSystem

Source

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.

Source

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)

Source

pub fn get_surface_secondary(&self, x: i32, z: i32) -> f64

Sample the surface secondary noise at a column position.

Source

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.

Source

fn frozen_edge(&self, xz: &mut TemperatureXzCache) -> f64

biome_info_noise.get_value(x*0.2, z*0.2), lazily cached.

Source

fn frozen_small(&self, xz: &mut TemperatureXzCache) -> f64

biome_info_noise.get_value(x*0.09, z*0.09), lazily cached.

Source

fn height_temp_noise_x8(&self, xz: &mut TemperatureXzCache) -> f64

temperature_noise.get_value(x/8, z/8) * 8.0, lazily cached.

Source

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.

Source

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.

Source

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.

Source

fn generate_bands(random: &mut RandomSource) -> [BlockStateId; 192]

Generate the 192-element terracotta band pattern.

Matches vanilla’s SurfaceSystem.generateBands().

Source

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

Source

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.

Source

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

Source§

fn condition_noise(&self, noise_index: usize, x: i32, z: i32) -> f64

Sample a surface condition noise at (x, z). The noise is identified by its index in the dimension’s surface_noise_ids() list.
Source§

fn condition_noise_3d(&self, noise_index: usize, x: i32, y: i32, z: i32) -> f64

Sample a surface condition noise at (x, y, z). The noise is identified by its index in the dimension’s surface_noise_ids() list.
Source§

fn get_band(&self, x: i32, y: i32, z: i32) -> BlockStateId

Get the badlands clay band block at position (x, y, z).
Source§

fn cold_enough_to_snow( &self, biome_id: u16, block_x: i32, block_y: i32, block_z: i32, ) -> bool

Evaluates whether the biome temperature is cold enough for snow.
Source§

fn vertical_gradient( &self, gradient_index: usize, block_x: i32, block_y: i32, block_z: i32, true_at_and_below: i32, false_at_and_above: i32, ) -> bool

Evaluate a vertical gradient condition using positional random. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> IntoShared for T

Source§

fn into_shared(self) -> Arc<Mutex<RawMutex, Self>>

Wraps this value in an Arc<SyncMutex<>>
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more