pub struct Aquifer<N: DimensionNoises> {Show 18 fields
location_cache: Vec<i64>,
status_cache: Vec<Option<FluidStatus>>,
splitter: RandomSplitter,
cache: N::ColumnCache,
min_grid_x: i32,
min_grid_y: i32,
min_grid_z: i32,
grid_size_x: i32,
grid_size_z: i32,
skip_sampling_above_y: i32,
sea_level: i32,
lava_floor: i32,
water_id: BlockStateId,
lava_id: BlockStateId,
default_fluid_id: BlockStateId,
should_schedule_fluid_update: bool,
col_cache: AquiferColumnCache,
prelim_cache: FxHashMap<(i32, i32), i32>,
}Expand description
Noise-based aquifer for a single chunk.
Constructed once per chunk, used throughout the fill loop.
Fields§
§location_cache: Vec<i64>Packed (x, y, z) locations of aquifer cell centers.
i64::MAX = not yet computed.
status_cache: Vec<Option<FluidStatus>>Lazily computed fluid statuses per grid cell.
splitter: RandomSplitterPositional random for grid cell jitter.
cache: N::ColumnCacheColumn cache owned by the aquifer for density function evaluation.
min_grid_x: i32Grid bounds.
min_grid_y: i32§min_grid_z: i32§grid_size_x: i32§grid_size_z: i32§skip_sampling_above_y: i32Skip aquifer sampling above this Y (optimization).
sea_level: i32Sea level for this dimension.
lava_floor: i32Precomputed min(LAVA_LEVEL, sea_level). Hoisted out of global_fluid
(which is on the per-block hot path) so we don’t recompute it millions
of times per chunk.
water_id: BlockStateIdBlock state IDs.
lava_id: BlockStateId§default_fluid_id: BlockStateIdThe dimension’s default fluid (water for overworld, lava for nether).
should_schedule_fluid_update: boolVanilla’s shouldScheduleFluidUpdate flag from the most recent substance lookup.
col_cache: AquiferColumnCache12-cell neighborhood snapshot for the current Y-column. Placed at the end so dimensions with disabled aquifers (nether/end) keep the hot fluid-id fields earlier in the struct’s cache lines.
prelim_cache: FxHashMap<(i32, i32), i32>Per-quart-column cache of preliminary_surface_level results, matching
vanilla’s NoiseBasedAquifer.preliminarySurfaceLevel Long2IntMap.
compute_fluid samples surface level 13× per aquifer cell, and each miss
recomputes the entire flat NormalNoise router for that column via
cache.ensure. Memoizing the i32 result per column collapses that to
one evaluation per unique column for the chunk.
Implementations§
Source§impl<N: DimensionNoises> Aquifer<N>
impl<N: DimensionNoises> Aquifer<N>
Sourcepub fn new(
chunk_min_x: i32,
chunk_min_z: i32,
min_block_y: i32,
y_block_size: i32,
splitter: &RandomSplitter,
noises: &N,
cache: N::ColumnCache,
) -> Self
pub fn new( chunk_min_x: i32, chunk_min_z: i32, min_block_y: i32, y_block_size: i32, splitter: &RandomSplitter, noises: &N, cache: N::ColumnCache, ) -> Self
Create an aquifer for a full 16×16 chunk.
chunk_min_x/z are the block coordinates of the chunk’s NW corner.
min_block_y and y_block_size define the vertical range.
splitter is the seed’s positional splitter.
cache should be a pre-initialized column cache for this chunk
(avoids a redundant init_grid call).
Sourcepub fn new_sized(
chunk_min_x: i32,
chunk_min_z: i32,
width_x: i32,
width_z: i32,
min_block_y: i32,
y_block_size: i32,
splitter: &RandomSplitter,
noises: &N,
cache: N::ColumnCache,
) -> Self
pub fn new_sized( chunk_min_x: i32, chunk_min_z: i32, width_x: i32, width_z: i32, min_block_y: i32, y_block_size: i32, splitter: &RandomSplitter, noises: &N, cache: N::ColumnCache, ) -> Self
Create an aquifer with custom XZ extent (in blocks). Vanilla’s iterateNoiseColumn uses width=cellWidth (4) for single-column queries.
fn max_preliminary_surface_level( noises: &N, cache: &mut N::ColumnCache, prelim_cache: &mut FxHashMap<(i32, i32), i32>, min_x: i32, min_z: i32, max_x: i32, max_z: i32, ) -> i32
const fn get_index(&self, gx: i32, gy: i32, gz: i32) -> usize
Sourcefn refill_col_cache(&mut self, world_x: i32, world_y: i32, world_z: i32) -> i32
fn refill_col_cache(&mut self, world_x: i32, world_y: i32, world_z: i32) -> i32
Refill the 12-cell column cache for the current (world_x, world_z, y_anchor).
Iterates the same (x1, y1, z1) order as the inline scan so cells are
stored at consistent indices, preserving tie-breaking when the per-Y
new_dist values are compared in compute_substance.
Sourcepub fn compute_substance(
&mut self,
noises: &N,
world_x: i32,
world_y: i32,
world_z: i32,
density: f64,
) -> AquiferResult
pub fn compute_substance( &mut self, noises: &N, world_x: i32, world_y: i32, world_z: i32, density: f64, ) -> AquiferResult
Compute what block to place at this position given the interpolated density.
Sourcepub const fn should_schedule_fluid_update(&self) -> bool
pub const fn should_schedule_fluid_update(&self) -> bool
Returns whether the most recent substance lookup needs postprocessing for placed fluids.
Sourcepub fn preliminary_surface_level(&mut self, noises: &N, x: i32, z: i32) -> i32
pub fn preliminary_surface_level(&mut self, noises: &N, x: i32, z: i32) -> i32
Returns the quart-quantized preliminary surface level, reusing this aquifer’s density-column and result caches.
Sourcefn get_aquifer_status(&mut self, index: usize, noises: &N) -> FluidStatus
fn get_aquifer_status(&mut self, index: usize, noises: &N) -> FluidStatus
Get or compute the fluid status for the aquifer cell at the given cache index.
Sourcefn compute_fluid(&mut self, x: i32, y: i32, z: i32, noises: &N) -> FluidStatus
fn compute_fluid(&mut self, x: i32, y: i32, z: i32, noises: &N) -> FluidStatus
Compute the fluid status for an aquifer cell centered at (x, y, z).
fn compute_surface_level( &mut self, x: i32, y: i32, z: i32, noises: &N, gf: FluidStatus, lowest_surface: i32, surface_under_global: bool, ) -> i32
fn compute_randomized_fluid_surface_level( &mut self, x: i32, y: i32, z: i32, noises: &N, lowest_surface: i32, ) -> i32
fn compute_fluid_type( &mut self, x: i32, y: i32, z: i32, noises: &N, gf: FluidStatus, fluid_level: i32, ) -> BlockStateId
Sourcefn calculate_pressure(
&mut self,
noises: &N,
x: i32,
y: i32,
z: i32,
barrier_noise: &mut f64,
s1: FluidStatus,
s2: FluidStatus,
) -> f64
fn calculate_pressure( &mut self, noises: &N, x: i32, y: i32, z: i32, barrier_noise: &mut f64, s1: FluidStatus, s2: FluidStatus, ) -> f64
Calculate barrier pressure between two aquifer cells.
Matches vanilla’s check: if lava meets water at this Y, return max pressure.
Auto Trait Implementations§
impl<N> Freeze for Aquifer<N>
impl<N> RefUnwindSafe for Aquifer<N>
impl<N> Send for Aquifer<N>
impl<N> Sync for Aquifer<N>
impl<N> Unpin for Aquifer<N>
impl<N> UnsafeUnpin for Aquifer<N>
impl<N> UnwindSafe for Aquifer<N>
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<>>